Guido van Rossum wrote: > On 9/9/05, Lisandro Dalcin <[EMAIL PROTECTED]> wrote: >>Any possibility to add one (or more) __future__ statement to >>implicitly get this behavior? Any suggestion about naming? > > > For the builtins, it would actually be possible to do this by simply > importing an alternate builtins module. Something like > > from future_builtins import min, max, zip, range > > For methods on standard objects like dicts it's not really possible > either way; the type of a dict is determined by the module containing > the code creating it, not the module containing the code using it.
However, such a "future_builtins" module could still include modified versions of those standard objects - such "future-proofed" code would simply still need to deal with the fact that other libraries or clients may pass in the old-style components (e.g. just as unicode-aware code needs to deal with the fact that other libraries or clients may produce 8-bit strings rather than unicode text). Also, an alternative to changing the builtins piecemeal would be to have "__python3_builtin__" in sys.modules and do: try: import __python3_builtin__ __builtins__ = __python3_builtin__ except ImportError: # What you do here depends on whether or not __python3_builtin__ # stays around in Py3k or not. You could then write a script to extract all known changes to the Py3k builtins by looking for differences between the two modules. Another trick would be to have an "everything in Python 3" option for any syntax changes too: from __future__ import __python3__ Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --------------------------------------------------------------- http://boredomandlaziness.blogspot.com _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com