
Sept. 26, 2011
1:48 p.m.
On 26 September 2011 14:03, Masklinn <masklinn@masklinn.net> wrote:
An other thing which strikes me as weird is that the proposal is basically the creation of private instance attribute on functions. Could you not get the same by actually setting an attribute on the function (this can not be used in lambdas in any case)?
def f(): print(f.i) f.i += 1 f.i = 17
This has been talked about before (in this thread or a related one). It would be slower (requiring two dictionary lookups for each access, rather than a single LOAD_DEREF / STORE_DEREF) and would break if the name 'f' is bound to another object. -- Arnaud