What's wrong with this code?

Steven D'Aprano steve+comp.lang.python at pearwood.info
Tue Jul 24 04:26:53 EDT 2012


On Tue, 24 Jul 2012 09:47:38 +0200, Ulrich Eckhardt wrote:

> [0] Note that in almost all cases, when referring to a tag, Python
> implicitly operates on the object attached to it. One case (the only
> one?) where it doesn't is the "del" statement.

Name-binding:

x = 1

operates on the name "x", not the object. The object 1 does not know it 
has been bound to anything -- that's one weakness of the "tag" model, 
because it implies that objects know what tags they have attached. They 
don't.

Imports:

import x

also operates on the name x and not the object.


-- 
Steven



More information about the Python-list mailing list