Greg Ewing <greg.ewing@canterbury.ac.nz> writes:
Nick Coghlan wrote:
postdef x = weakref.ref(obj, def) def report_destruction(obj): print("{} is being destroyed".format(obj))
postdef funcs = [def(i) for i in range(10)] def make_incrementor(i): postdef return def def incrementor(x): return x + i
postdef sorted_list = sorted(original, key=def) def normalise(item): …
That actually looks quite readable to me, and is fairly explicit about what it does:
Sorry, but I think it only looks that way to you because you invented it. To me, all of these look like two completely separate statements: some weird thing starting with "postdef", and then a function definition.
I have to agree. The decorator syntax was hotly debated for (in part) the very same reason: when looking at the definition of a function, a statement *preceding* the definition is not obviously connected. -- \ “Everyone is entitled to their own opinions, but they are not | `\ entitled to their own facts.” —US Senator Pat Moynihan | _o__) | Ben Finney