On May 8, 2:58 am, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > George Sakkis wrote: > > One of the few Python constructs that feels less elegant than > > necessary to me is the del statement. For one thing, it is overloaded > > to mean three different things: > > (1) del x: Remove x from the current namespace > > (2) del x[i]: Equivalent to x.__delitem__(i) > > (3) del x.a: Equivalent to x.__delattr__('a') (or delattr(x,'a')) > > Note that the 'X = Y' construct has the corresponding three meanings: > > (1) x = 4 # Bind x to 4 in the 'current namespace' > (2) x[i] = 4 # equivalent to x.__setitem__(i, 4) > (3) x.a = 4 # Equivalent to x.__setattr__('a', 4) > > What conclusion should we draw from that?
I think you're trying to imply that it is consistent with setting a value (same with getting). I guess what bugs me about "del" is that it's a keyword and not some universally well-known punctuation. Do you you feel that Python misses a "pop" keyword and respective expressions ? (1) pop x: Remove x from the current namespace and return it. (2) pop x[i]: Instead of x.pop(i) (3) pop x.a: Equivalent to "_y=x.a; del x.a; return y" George -- http://mail.python.org/mailman/listinfo/python-list