Mark Dickinson added the comment:

Surprisingly, this is valid syntax.  Your first line is parsed as:

    0xf or (python is weird in ways)

Because `or` is short-circuiting, its right-hand operand (which is also valid 
syntactically, being a chained comparison) is never evaluated, so we don't see 
the `NameErrors` that you might expect.

    >>> python is weird in ways
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    NameError: name 'python' is not defined

Your second example is similar.  Closing as 'not a bug'.

----------
nosy: +mark.dickinson
resolution:  -> not a bug
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue21979>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to