why do we invoke print after importing print_function (in Python 2.6)

前端 未结 6 907
再見小時候
再見小時候 2021-01-01 08:15

To get the 3.0 print function we do the following in Python 2.6:

from __future__ import print_function

But to use the function we invoke pr

6条回答
  •  醉梦人生
    2021-01-01 08:59

    For completness, all the currently available features are:

    +------------------+-------------+--------------+----------------------------------------------------+
    |     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     |          3.0 | 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            |
    | generator_stop   | 3.5.0b1     |          3.7 | PEP 479: StopIteration handling inside generators  |
    | annotations      | 3.7.0b1     |          4.0 | PEP 563: Postponed evaluation of annotations       |
    +------------------+-------------+--------------+----------------------------------------------------+
    

提交回复
热议问题