[Python-ideas] Make "is" checks on non-singleton literals errors
Chris Angelico
rosuav at gmail.com
Tue Oct 9 03:06:13 EDT 2012
More information about the Python-list mailing list
Tue Oct 9 03:06:13 EDT 2012
- Previous message (by thread): Plumbum (Shell Combinators) hits v1.0
- Next message (by thread): Blue Screen Python
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, Oct 9, 2012 at 1:14 PM, Guido van Rossum <guido at python.org> wrote: > Maybe we should do something more drastic and always create a new, > unique constant whenever a literal occurs as an argument of 'is' or > 'is not'? Then such code would never work, leading people to examine > their code more closely. I betcha we have people who could change the > bytecode compiler easily enough to do that. (I'm not seriously > proposing this, except as a threat of what we could do if the > SyntaxWarning is rejected. :-) That wouldn't guarantee that the code would never work, merely that the 'is' checks would be never true. Dangerous if the condition is a guard for an unusual condition. A unit test could of course catch it, but that assumes that everyone who writes "if x is 0" has tests probing both branches of that check... ChrisA
- Previous message (by thread): Plumbum (Shell Combinators) hits v1.0
- Next message (by thread): Blue Screen Python
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list