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

_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to