A counter-proposal to __future__ in PEP 236

Tim Peters tim.one at home.com
Sat Mar 3 04:08:42 EST 2001


Very quickly:

[Michael Chermside]
> ...
> It is *NOT* an actual import statement,

Not so.  Please read the PEP.

> and it does *NOT* scream "black-magic" -- just looks like another of
> those special "built-in" things; you know... the functions __cmp__ and
> __import__ and the modules __builtin__ and  __future__.

Yes, but names with double double-underscores are Python's way of saying
"black magic -- you're interfacing with language internals here".

> ...
> Through the creation of an (empty) "__future__" module, it becomes
> possible to write code that compiles and and runs fine in pre-2.1
> versions of python,

No.  Because it *is* an import statement, pre-2.1 versions of Python will
choke at runtime on the failure to find __future__.py, or the failure to
import the specific feature(s) named.  This is all explained in the PEP, and
indeed more than once.  BTW, double double-underscore names are reserved for
the language's use, so you've got no business creating your own __future__.py
anyway.

can-make-it-foolproof-but-not-damned-fool-proof<wink>-ly y'rs  - tim





More information about the Python-list mailing list