[New-bugs-announce] [issue26908] "1and 0" evaluated a zero, instead of SyntaxError

Vladimir Rutsky report at bugs.python.org
Mon May 2 12:59:43 EDT 2016

New submission from Vladimir Rutsky:

Looks like there is no need to place space separators after numbers:

$ python3.5 -c "print(1and 0)"
$ python3.5 -c "print([1for i in range(1)])"

Not sure is this a bug or a feature, but I would expect that this should be SyntaxError, same as here:

$ python3.5 -c "1 and0"
  File "<string>", line 1
    1 and0
SyntaxError: invalid syntax

If this is a feature, can anyone give reasoning for it?

messages: 264654
nosy: rutsky
priority: normal
severity: normal
status: open
title: "1and 0" evaluated a zero, instead of SyntaxError
versions: Python 2.7, Python 3.4, Python 3.5

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list