"Either" 和 "Maybe" 数据结构
项目描述
https://github.com/kennknowles/python-either
此库为Python提供两种基本的数据结构
Either 也称为“积”,“和类型”,“变体”,“标记联合”,“非联合”等:来自两个集合之一的值
Maybe 也称为“选项”或“Either Nothing”:可能缺失的值。(Python有“None”,但它不能组合)
每个都是 ~10 行代码,主要是样板代码,但现在它们都在库中的一个地方。
进一步阅读
如果您不熟悉这些概念,这里有一些来自网络的文章
Either
[标记联合(维基百科)](http://en.wikipedia.org/wiki/Tagged_union)
[Either(Scala)](https://scala-lang.org.cn/api/current/scala/Either.html)
[Boost.Variant(C++)](https://boost.ac.cn/doc/libs/1_50_0/doc/html/variant.html)
[Data.Either(Haskell)](http://www.haskell.org/ghc/docs/latest/html/libraries/base/Data-Either.html)
[std.variant(D)](http://dlang.org/phobos/std_variant.html)
Maybe
[Option(Scala)](https://scala-lang.org.cn/api/current/scala/Option.html)
[Maybe(Java)](https://github.com/npryce/maybe-java)
[Maybe模式(Python配方)](http://code.activestate.com/recipes/577248-maybe-pattern/)
[Data.Maybe(Haskell)](http://www.haskell.org/ghc/docs/latest/html/libraries/base/Data-Maybe.html)
[Maybe(Ruby)](https://github.com/bhb/maybe)
贡献者
[Kenn Knowles](https://github.com/kennknowles) ([@kennknowles](https://twitter.com/KennKnowles))
版权和许可
版权所有 2012- Kenneth Knowles
遵循Apache许可证第2版(以下简称“许可证”);除非适用法律要求或书面同意,否则不得使用此文件,除非遵守许可证。您可以在以下地址获取许可证副本:
除非适用法律要求或书面同意,否则在许可证下分发的软件按“原样”提供,不提供任何明示或暗示的保证或条件。有关许可证的具体语言,请参阅许可证。
项目详情
either-0.2.tar.gz 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | aa1f52f720152a659daafbb07061c7080aad36b3e42b4068347c016ffc814641 |
|
MD5 | d02b0c10e7e528d9c01426ce418214e7 |
|
BLAKE2b-256 | 3a6b566b402a772e3ce9a7b5a51fb9acfc4caa1e4275763b946ff802bc82c587 |