[Python-ideas] PEP 505 (None coalescing operators) thoughts
Ben Finney
ben+python at benfinney.id.au
Mon Sep 28 22:38:37 CEST 2015
More information about the Python-ideas mailing list
Mon Sep 28 22:38:37 CEST 2015
- Previous message (by thread): [Python-ideas] PEP 505 (None coalescing operators) thoughts
- Next message (by thread): [Python-ideas] PEP 505 (None coalescing operators) thoughts
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Guido van Rossum <guido at python.org> writes: > This seems a perfect use case for writing post?.tag.lower() -- this > signifies that post may be None but if it exists, post.tag is not > expected to be None. So basically I want the equivalent of > (post.tag.lower() if post is not None else None). You're deliberately choosing straightforward examples. That's fine for showing the intended use case, but it does mean dismissing the concerns about ambiguity in complex cases. It also means the use cases are so simply they are easily expressed succinctly with existing syntax, with the advantage of being more explicit in their effect; so they don't argue strongly for the need to add the new syntax. So, the corner case examples in this thread, which mix up precedence, are useful because they show how confusion is increased by making the precedence and binding rules more complicated. -- \ “People are very open-minded about new things, as long as | `\ they're exactly like the old ones.” —Charles F. Kettering | _o__) | Ben Finney
- Previous message (by thread): [Python-ideas] PEP 505 (None coalescing operators) thoughts
- Next message (by thread): [Python-ideas] PEP 505 (None coalescing operators) thoughts
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-ideas mailing list