0.75
--------------------------------------------------------------------------------------------
导入精确除法后,若要执行截断除法,可以使用"//"操作符:-------------------------------------------------------------------------------------------->>> 3//40>>> --------------------------------------------------------------------------------------------一些将来特征如下:feature | optional in | mandatory in | effect |
---|---|---|---|
nested_scopes | 2.1.0b1 | 2.2 | PEP 227: Statically Nested Scopes |
generators | 2.2.0a1 | 2.3 | PEP 255: Simple Generators |
division | 2.2.0a2 | 3.0 | PEP 238: Changing the Division Operator |
absolute_import | 2.5.0a1 | 2.7 | PEP 328: Imports: Multi-Line and Absolute/Relative |
with_statement | 2.5.0a1 | 2.6 | PEP 343: The “with” Statement |
PRint_function | 2.6.0a2 | 3.0 | PEP 3105: Make print a function |
unicode_literals | 2.6.0a2 | 3.0 | PEP 3112: Bytes literals in Python 3000 |
PEP:Python Enhancement Proposals可以在这个地方找到很多PEP:http://www.python.org/dev/peps/ 里面还能看到许多提议的动机比如有division:The current division (/) operator has an ambiguous meaning for numerical arguments:it returns the floor of the mathematical result of division if the arguments are ints or longs, but it returns a reasonable approximation of the division result if the arguments are floats or complex.This makes expressions expecting float or complex results error-prone when integers are not expected but possible as inputs.
新闻热点
疑难解答