[Python-Dev] Assignment to None (original) (raw)
"Martin v. Löwis" martin at v.loewis.de
Mon Jun 9 07:19:44 CEST 2008
- Previous message: [Python-Dev] xmlrpclib.{True, False} (was Re: Assignment to None)
- Next message: [Python-Dev] Tuple pack/unpack and the definition of AST Assign nodes
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
So, it's okay to setattr the attribute name "None" but not okay to set it directly? Is this deliberate or is it an unintentional side effect of parser changes to prevent assignment to None?
It's deliberate. setattr(o, "foo bar", "baz") also works, even though "foo bar" is not an identifier. setattr doesn't take the Python grammar into account, but only the object's structure.
Regards, Martin
- Previous message: [Python-Dev] xmlrpclib.{True, False} (was Re: Assignment to None)
- Next message: [Python-Dev] Tuple pack/unpack and the definition of AST Assign nodes
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]