What's wrong with this code?

Chris Angelico rosuav at gmail.com
Tue Jul 24 04:24:57 EDT 2012


On Tue, Jul 24, 2012 at 5:47 PM, Ulrich Eckhardt
<ulrich.eckhardt at dominolaser.com> wrote:
> There is one model that has helped me much understanding how Python ticks
> and that is the model of name tags. The code "a = 1" creates an integer with
> value 1 and attaches a tag with "a" written on it using a small piece of
> rope.

A double strand of rope, I think. If it were one strand, we'd write "a - 1". :)

> [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.

I'd say that del is more closely related to assignment than anything
else. You can go "a = None" to mark that a now points to nothing, or
you can "del a" to de-rope a altogether.

ChrisA



More information about the Python-list mailing list