Miscellaneous PEP 403 notes

Issue #1 open
Nick Coghlan
repo owner created an issue

Blend PEP 403 with PEP 3150 by using the Ellipsis literal as a forward reference to a trailing anonymousfunction definition.

Syntax: {{{ in x = weakref.ref(target, ...) def ...(obj): print("{} is being destroyed".format(obj))

in sorted_list = sorted(original, key=...) def ...(value): try: return item.calc_sort_order() except NotSortableError: return float('inf')

in environ = ...() def ...(): ... # 27 line os._create_environ() function

in funcs = [...(i) for i in range(10)] def ...(i): do return ... given (x): return x + i }}}

Comments (5)

  1. Nick Coghlan reporter
    • changed status to open

    After writing this up in a new draft of PEP 403, I realised the Ellipsis notation was cute, but didn't really work for the "class" case, and got very confusing when these constructs were nested. Accordingly, the PEP switched back to using named forward references.

    Jim Jewett pointed out that the PEP needs to document the justification for using decorator-inspired syntax rather than a full nested suite, or some kind of restricted suite.

  2. Log in to comment