Thanks for tracing this Tom. I was meaning to look into it but never got
round to it.
Jens
tor. 14. maj 2015 kl. 03.30 skrev Juan Nunez-Iglesias :
> Thanks Tom! Absolutely fascinating! I was trying to grok this and
> thinking, "but what if we want 'or' to return a value that will later be
> used
Thanks Tom! Absolutely fascinating! I was trying to grok this and thinking,
"but what if we want 'or' to return a value that will later be used as a
conditional, surely it should return bool?" But of course whatever it
returns will be correctly interpreted as a bool in a conditional context!
Delaye
The `a or b` syntax evaluates if a is 'trueish' and if so returns a if not
returns b so `c = None or {}` -> c == {} but `c = {'a': 1} or {}` -> c ==
{'a': 1}
See
https://docs.python.org/3.5/reference/expressions.html#grammar-token-or_test
for the docs on or. and works almost the same, but returns
Fascinating! Can you "unpack" (heh) that error for us mere mortals? In
particular:
- never seen that "or" syntax before... Is it coercing both expressions as
bool, or is it evaluating to left if bool(left) evaluates to True, else to
right?
- Why do you expect the second expression to work? Is ** s
The failures on python nightly are currently due to a bug in python (
http://bugs.python.org/issue24176)
Tom
--
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring sup