[Python-Dev] [Python-3000] Warning for 2.6 and greater

A.M. Kuchling amk at amk.ca
Tue Jan 16 12:29:48 CET 2007


On Mon, Jan 15, 2007 at 11:40:22PM +0100, "Martin v. L??wis" wrote:
> > Do I just suffer from having an overactive imagination?  Are all of
> > these implementation strategies impossible for some reason, and there
> > are no others?
> 
> Yes, and yes.

What about turning all references to obj.items into the equivalent
bytecode for this:

if isinstance(obj, dict): # XXX should this be 'type(obj) is dict'?
   if <2.x behaviour>:   _temp = obj.items
   elif <3.x behaviour>: _temp = obj.iteritems
else:
   _temp = obj.items

Ugly; very ugly.

--amk



More information about the Python-Dev mailing list