[Python-ideas] Removing the del statement
Adam Atlas
adam at atlas.st
Fri Sep 28 03:58:11 CEST 2007
On 27 Sep 2007, at 21:47, George Sakkis wrote:
> I guess this has very few to zero chances of being considered, even
> for Python 3, but this being python-ideas I guess it's ok to bring
> it up. IMO the del statement is one of the relatively few
> constructs that stick out like a sore thumb. 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') and delattr(x,'a')
I guess this has very few to zero chances of being considered, even
for Python 3, but this being python-ideas I guess it's ok to bring it
up. IMO the = statement is one of the relatively few constructs that
stick out like a sore thumb. For one thing, it is overloaded to mean
three different things:
1) x = : Assign x in the current namespace
2) x[i] = : Equivalent to x.__setitem__(i)
3) x.a = : Equivalent to x.__setattr__('a') and setattr(x,'a')
(Sorry for the slight sarcasm, but I hope you see my point. I don't
see why the deletion statement should go while the perfectly
complementary and nearly-identically-"overloaded" assignment
statement should stay.)
More information about the Python-ideas
mailing list