指定变量的地点
let3的Python项目详细描述
让3
随时随地分配变量。
概述
let3 is a strict fork of Taylor Marks’s let package with a fix allowing to work with Python3 or higher and with a little code reformatting and minor improvements.
Overview below is a copy from the original let website (with only the necessary changes regarding let3).
快速启动
一旦安装完毕,您就可以很快验证它是否可以使用以下功能:
>>>fromletimportlet>>>iflet(count=len('Hello World!')):...print(count)12
文件
在C、Java和许多其他语言中,可以在 if或while条件语句的。这有助于让您简明地 两者都指定值,并检查是否满足条件。
这个能力在Python中不存在,因为人们想到的时候 写些类似的东西:
ifrow=db.fetch_results():...
它们实际上可能是指:
ifrow==db.fetch_results():...
就我个人而言,我从来没有犯过这个错误。看起来更像是理论上的 可能发生的错误比实际发生的错误要多 删除特性,正如在python中选择的那样。
不管怎样,这个模块中的let函数提供了一些非常接近的东西 其他语言能力。几个例子:
iflet(name=longInstanceName.longAttributeName):...# Yes, db.fetch_results() should just return a generator. No, it doesn't.whilelet(results=db.fetch_results()):...iflet(count=len(nameValuePair))!=1:raiseException('Bad amount: {}'.format(count))
安装
- python 3.4或更高版本
- http://www.python.org/
- 2.7和3.7是主要的测试环境。
- pip和setuptools
要安装,请运行:
python -m pip install --upgrade let3
开发
从源安装:
克隆sources并运行:
python -m pip install ./let3
或开发模式:
python -m pip install --editable ./let3
先决条件:
开发严格基于tox。要安装它,请运行:
python -m pip install tox
许可证
Copyright (c) 2016 Taylor MarksCopyright (c) 2016-2019 Adam KarpierzLicensed under the MIT LicensePlease refer to the accompanying LICENSE file.
更改日志
1.0.11(2019-05-22)
- 放弃对python 2的支持。
1.0.10(2019-05-21)
- 更新所需的setuptools版本。
- 安装更新和改进。
- 这是支持python 2的最新版本。
1.0.9(2018-11-08)
- 放弃对Python2.6和3.0-3.3的支持
- 更新所需的setuptools版本。
1.0.8(2018-05-08)
- 更新所需的setuptools版本。
- 改进和简化安装和打包。
1.0.7(2018-02-26)
- 改进和简化安装和打包。
1.0.6(2018-01-28)
- 修复tox.ini中的错误和不一致性
- 更新readme.rst。
1.0.3(2018-01-24)
- 更新所需的sphinx版本。
- 更新doc sphinx配置文件。
1.0.2(2017-11-18)
- 安装改进。
- 其他小改进。
1.0.1(2017-01-05)
- 创建taylor marks的let包的fork,修复允许 与Python3或更高的生物一起工作。
- 小改进。
更改原始let:
1.0.1(2016年2月25日)
- 现在让我们将变量分配给全局命名空间always-never 本地命名空间。python解释器有时会优化变量 在本地命名空间中-最好不要更改其后面的值 回到过去,因为这会导致很难发现错误。
1.0.0(2016年2月7日)
- 初始提交