Stefan Ram wrote: > Peter Otten <__pete...@web.de> writes: >>team.pop(2) >>Stefan's explanation may work for >>del x >>if you discard >>x = None # get rid of the huge object that x was bound to before >>as a hack > > »x = None« observably has not the same effect as »del x«: > > |>>> x = 2; x = None; x > |>>> x = 2; del x; x > |NameError: name 'x' is not defined
That's a minor technical detail. I understood the original question as one regarding language design, and I don't think merely stating what a statement does counts as a reason for its inclusion in the language. x = None covers the memory-micromanaging aspect of del x which makes some marginal sense. I expect to see the NameError (control flow aspect, if you will) only when there's a bug in the program. -- https://mail.python.org/mailman/listinfo/python-list