
Oct. 14, 2011
5:03 p.m.
Greg Ewing wrote:
Nick Coghlan wrote:
With this variant, I would suggest that any postdef clause be executed *in addition* to the normal name binding. Colliding on dummy names like "func" would then be like colliding on loop variables like "i" - typically harmless, because you don't use the names outside the constructs that define them anyway.
That sounds reasonable. However, if we're binding the name anyway, why not use it in the main clause instead of introducing something weird like a lone 'def'?
postdef x = weakref.ref(obj, report_destruction): def report_destruction(obj): print("{} is being destroyed".format(obj))
+1 ~Ethan~