top | item 43770482 (no title) hiichbindermax | 10 months ago Nitpick about 9.3 Short Circuit Evaluation: both things evaluate differently if you have empty strings. The if-else clause treats empty strings as valid while the or operator will treat them equivalent with None. discuss order hn newest TACD|10 months ago Similarly with 9.2, assignment using a walrus operator will also fail if the value is 0 (or anything falsy: https://docs.python.org/3/library/stdtypes.html#truth-value-...) maleldil|10 months ago You can use `if (response := get_user_input()) is not None` if that's important. IME, empty strings and None would be treated the same way.
TACD|10 months ago Similarly with 9.2, assignment using a walrus operator will also fail if the value is 0 (or anything falsy: https://docs.python.org/3/library/stdtypes.html#truth-value-...) maleldil|10 months ago You can use `if (response := get_user_input()) is not None` if that's important. IME, empty strings and None would be treated the same way.
maleldil|10 months ago You can use `if (response := get_user_input()) is not None` if that's important. IME, empty strings and None would be treated the same way.
TACD|10 months ago
maleldil|10 months ago