[Python-Dev] Very Strange Argument Handling Behavior (original) (raw)
Maciej Fijalkowski fijall at gmail.com
Sat Apr 17 23:47:08 CEST 2010
- Previous message: [Python-Dev] Very Strange Argument Handling Behavior
- Next message: [Python-Dev] Very Strange Argument Handling Behavior
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message: [Python-Dev] Very Strange Argument Handling Behavior
- Next message: [Python-Dev] Very Strange Argument Handling Behavior
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]