Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #93673
| References | <01ec6551-1f40-42b0-9406-036030591519@googlegroups.com> |
|---|---|
| Date | 2015-07-11 20:38 +1000 |
| Subject | Re: 0 + not 0 |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.416.1436611135.3674.python-list@python.org> (permalink) |
On Sat, Jul 11, 2015 at 8:26 PM, candide <c.candide@laposte.net> wrote: >>>> 0 + not 0 > File "<stdin>", line 1 > 0 + not 0 > ^ > SyntaxError: invalid syntax >>>> > > > What is syntactically wrong with 0 + not 0? I'm actually not sure why this can't be handled. Possibly it's a limitation of the parser. Certainly 0 + (not 0) works just fine. This suggests that the exponentiation operator may have been special-cased to cope with this: https://docs.python.org/3/reference/expressions.html#id21 So maybe there's just no corresponding special case for this - which, I have to say, is not exactly a common construct. ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
0 + not 0 candide <c.candide@laposte.net> - 2015-07-11 03:26 -0700
Re: 0 + not 0 Chris Angelico <rosuav@gmail.com> - 2015-07-11 20:38 +1000
Re: 0 + not 0 Irmen de Jong <irmen.NOSPAM@xs4all.nl> - 2015-07-11 12:38 +0200
Re: 0 + not 0 Luuk <luuk@invalid.lan> - 2015-07-11 13:12 +0200
Re: 0 + not 0 Chris Angelico <rosuav@gmail.com> - 2015-07-11 21:20 +1000
Re: 0 + not 0 Luuk <luuk@invalid.lan> - 2015-07-11 13:30 +0200
Re: 0 + not 0 candide <c.candide@laposte.net> - 2015-07-11 04:54 -0700
Re: 0 + not 0 Chris Angelico <rosuav@gmail.com> - 2015-07-11 22:05 +1000
Re: 0 + not 0 candide <c.candide@laposte.net> - 2015-07-11 06:22 -0700
Re: 0 + not 0 candide <c.candide@laposte.net> - 2015-07-11 04:48 -0700
Re: 0 + not 0 random832@fastmail.us - 2015-07-11 16:46 -0400
Re: 0 + not 0 Serhiy Storchaka <storchaka@gmail.com> - 2015-07-11 16:38 +0300
Re: 0 + not 0 candide <c.candide@laposte.net> - 2015-07-11 08:07 -0700
Re: 0 + not 0 MRAB <python@mrabarnett.plus.com> - 2015-07-11 17:20 +0100
Re: 0 + not 0 Ian Kelly <ian.g.kelly@gmail.com> - 2015-07-11 10:56 -0600
Re: 0 + not 0 Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2015-07-12 18:12 +1200
Re: 0 + not 0 Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-07-11 21:05 +0100
csiph-web