[Tutor] A slight bug in IDLE
eryksun
eryksun at gmail.com
Sun Jul 14 06:41:40 CEST 2013
On Sat, Jul 13, 2013 at 11:03 PM, Steven D'Aprano <steve at pearwood.info> wrote:
>
> from __future__ import braces
That joke is hard-coded, going back to version 2.1 when __future__
imports were added. It's also implemented in Jython and PyPy.
http://hg.python.org/cpython/file/2.1/Python/future.c
http://hg.python.org/cpython/file/3.3/Python/future.c
(extremely off topic: look how simple the future_parse function is
using an abstract syntax tree compared to working with the low-level
tree in 2.1.)
>> from __future__ import generators, division, with_statement,
>> print_function
>> import sys
>> if int(sys.version[0]) < 3: input = raw_input
>
>
> You don't need generators in 2.7, they have been standard since Python 2.4.
A lot of new packages support versions 2.6+, which have the "with"
statement enabled.
@Jim: Don't parse sys.version like that. Use sys.version_info[0].
More information about the Tutor
mailing list