On 08:19 am, [EMAIL PROTECTED] wrote:
>Georg Brandl schrieb:
>>> If Python 3.0 was simply a release which removed deprecated features,
>>> there would clearly be no issue. I would update my code in advance of
>>> the 3.0 release to not use any of those features being removed, and
>>> I'm all set. But that's not what I'm hearing. Python 3 is both adding
>>> new ways to do things, and removing the older way, in the same
>>> version, with no overlap. This makes me very anxious.
>>
>> It has always been planned that in those cases that allow it, the new way to 
>> do
>> it will be introduced in a 2.x release too, and the old way removed only in 
>> 3.x.
>
>What does that mean for the example James gave: if dict.items is going
>to be an iterator in 3.0, what 2.x version can make it return an
>iterator, when it currently returns a list?
>
>There simply can't be a 2.x version that *introduces* the new way, as it
>is not merely a new API, but a changed API.

The API isn't changed.  It's just dependent on its execution context in a 
confusing way.  That difference right now is being reflected as "2.x VM" vs. 
"3.0 VM" but there are other ways to reflect it more explicitly.  It would 
certainly be possible to have:

   from __future__ import items_is_iter

be the same as:

   __py3k_compat_items_is_iter__ = True

and have the 2.x series' items() method check the globals() of the calling 
scope to identify the return value of items() in that particular context.

If the actual data structures of module dictionaries and stack objects are too 
expensive there are other, similar things that could be done at the C level.  
This implementation strategy is just the obvious thing that occurred to me 
after maybe 2 minutes of consideration.  I'm sure someone more familiar with 
the internals of Python could come up with something better.
_______________________________________________
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

Reply via email to