Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #30999 > unrolled thread
| Started by | Chris Angelico <rosuav@gmail.com> |
|---|---|
| First post | 2012-10-09 18:06 +1100 |
| Last post | 2012-10-09 18:06 +1100 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [Python-ideas] Make "is" checks on non-singleton literals errors Chris Angelico <rosuav@gmail.com> - 2012-10-09 18:06 +1100
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2012-10-09 18:06 +1100 |
| Subject | Re: [Python-ideas] Make "is" checks on non-singleton literals errors |
| Message-ID | <mailman.1983.1349766382.27098.python-list@python.org> |
On Tue, Oct 9, 2012 at 1:14 PM, Guido van Rossum <guido@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
Back to top | Article view | comp.lang.python
csiph-web