[Python-Dev] Non-string keys in type dict (original) (raw)
Ethan Furman ethan at stoneleaf.us
Thu Mar 8 08:46:34 CET 2012
- Previous message: [Python-Dev] Non-string keys in type dict
- Next message: [Python-Dev] Non-string keys in type dict
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Nick Coghlan wrote:
On Thu, Mar 8, 2012 at 11:42 AM, Benjamin Peterson <benjamin at python.org> wrote:
2012/3/7 Victor Stinner <victor.stinner at gmail.com>:
Can't we simply raise an error if the dict contains non-string keys? Sounds okay to me. For 3.3, the most we can do is trigger a deprecation warning, since removing this feature will break currently running code. I don't have any objection to us starting down that path, though.
I think it would be sad to lose that functionality.
If we are going to, though, we may as well check the string to make sure it's a valid identifier:
--> class A: --> pass --> setattr(A, '42', 'hrm') --> A.42 File "", line 1 A.42 ^ SyntaxError: invalid syntax
Doesn't seem very useful.
Ethan
- Previous message: [Python-Dev] Non-string keys in type dict
- Next message: [Python-Dev] Non-string keys in type dict
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]