[Python-3000] Python 3000 Status Update (Long!)
Neil Toronto
ntoronto at cs.byu.edu
Fri Jun 22 22:13:39 CEST 2007
Andrew McNabb wrote:
> On Fri, Jun 22, 2007 at 01:32:42PM -0600, Neil Toronto wrote:
>
>>> (imap is faster in this case because the built-in name 'abs' is looked
>>> up only once -- in the genexp, it's looked up each time, sigh --
>>> possibly the biggest "we should REALLY tweak the language to let this
>>> be optimized sensibly" gotcha in Python, IMHO).
>>>
>> What is it about the language as it stands that requires abs() to be
>> looked up each iteration?
>>
>
> Calling abs() could change locals()['abs'], in which case a different
> function would be called the next time through. You lookup 'abs' each
> time just in case it's changed.
>
I can't think of a reason to allow that outside of something like an
obfuscated Python code contest. I'm sure there exists someone who thinks
differently...
Neil
More information about the Python-3000
mailing list