Steven D'Aprano <[email protected]> added the comment:
Sorry, I don't understand your demonstration. What's the mystery ``parser``
object with an ``expr`` method? What is it doing?
Your comment says "all binary/unary number ops work" but I don't know what you
mean by "work". Could you show some plain, vanilla Python code that
demonstrates the problem?
>From your description here:
> an unparenthesized comparison expression cannot be unpacked using
> the *iterable "unpack" operator
it sounds like you are talking about an operator precedence issue. Am I close?
But I think you are wrong:
py> print(*[] < [1, 2])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: print() argument after * must be an iterable, not bool
suggests that the < operator is evaluated before trying to unpack.
Let's try with something else:
class X:
def __lt__(self, other):
return [1, 2, 3]
py> print(*X() < None)
1 2 3
Perhaps I have misunderstood something.
----------
nosy: +steven.daprano
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue36617>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com