A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2010-April/099502.html below:

[Python-Dev] Very Strange Argument Handling Behavior

[Python-Dev] Very Strange Argument Handling Behavior [Python-Dev] Very Strange Argument Handling BehaviorMaciej Fijalkowski fijall at gmail.com
Sat Apr 17 23:47:08 CEST 2010
On Sat, Apr 17, 2010 at 1:03 PM, Steve Holden <steve at holdenweb.com> wrote:
> Dino Viehland wrote:
>> Maciej wrote:
> [...]
>>> And yet that breaks some code :-)
>>
>> Sure, if you do:
>>
>> class C(object):
>>     locals()[object()] = 42
>>
>> dir(C)
>>
>> You lose.  Once I'm aware of some piece of code in the wild doing this
>> then I'll be happy to change IronPython to be more compatible. :)
>>
>>
> This would be a lose anyway, since the CPython specifications suggest
> that you should not rely on being able to change locals() (or at least
> shouldn't expect that such changes are actually reflected in the local
> namespace).

You can override __new__ of a type subclass to achieve the same effect
(or even directly call type.__new__ with strange dict as an argument).

Cheers,
fijal
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4