[Python-Dev] Proposed 3.0 compatiblity module

Raymond Hettinger raymond.hettinger at verizon.net
Fri Jan 12 20:33:53 CET 2007


ISTM, we can decide to limit 3.0's impact to a single compatibility module, 
essentially as an alternate set of builtins.

import __new_builtins__
for name in 'bytes dict coerce'.split():      # list any new features you want 
to support
    setattr(__builtins__, name, getattr(__new_builtins__, name))

The bytes type would just be the new type.
The dict would have keys=iterkeys, no has_key, etc.
The coerce function would work but have a DeprecationWarning or somesuch.
If you want future division, we already have a mechanism for that.
If you want to eliminate backticks, just grep for them.
If you don't care about 3.0 compatibilty, just don't import the module.

Outside of a compatibility module, we can decide to leave Py2.6 unmolested by 
Py3.0, so I can stop being cranky.


Raymond 



More information about the Python-Dev mailing list