why does dead code costs time?

Chris Kaynor ckaynor at zindagigames.com
Wed Dec 5 21:49:24 CET 2012


On Wed, Dec 5, 2012 at 12:41 PM, Terry Reedy <tjreedy at udel.edu> wrote:

> On 12/5/2012 1:24 PM, Bruno Dupuis wrote:
>
>> On Wed, Dec 05, 2012 at 10:59:26AM -0700, Ian Kelly wrote:
>>>
>>> I think this should even be considered a bug, not just a missing
>>> optimization.  Consider:
>>>
>>
>> This is definitely a bug
>>
>>  globals()['None'] = 42
>>>>>> def f(x):
>>>>>>
>>>>> ...     return None
>>> ...     print(x)
>>> ...
>>>
>>>>  f('test')
>>>>>>
>>>>> 42
>>>
>>
>> This one is pretty scary
>>
>> The difference between `return None` and `return` leads to inconsistency
>> and
>> is in contradiction with the specs, AFAIK. I'm glad we pointed this out.
>>
>
> You did not specify version, but I confirmed in 3.3.0. Please open a
> tracker issue.


It also occurs in 2.6.4
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20121205/1ce7c24d/attachment.html>


More information about the Python-list mailing list