Paul Ganssle <[email protected]> added the comment:
I think the reason for the difference here is in the `no_error` function you
never actually create the coroutine `true()`, so there's nothing to warn about.
One thing that's confusing things about this example is that the `false()`
evaluates to True, because it returns a coroutine object (rather than the value
`False`):
>>> async def false():
...: return False
...:
>>> bool(false())
True
If you expand your `false() or true()` statement, it's equivalent to:
x = false()
if not x:
x = true()
return await x
Since `false()` is truthy, you don't expect true() to ever be called, hence no
warning.
@YoSTEALTH Does this make sense? Does it solve the issue?
----------
nosy: +p-ganssle
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue37299>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com