[Edu-sig] Sticky-note Analogy
John Posner
jjposner at snet.net
Fri May 9 07:08:05 CEST 2008
> Partly why it's misleading to speak of names as variables is
> that shoptalk tends to prevent us from seeing 8 as the *name*
> of an immutable object, one for which the name is hardwired
> (but feel free to bind, or assign, other not-spoken-for names
> to the same object).
I don't see the advantage of thinking of "8" as a name. It's just some
syntax that creates an unnamed object. In that sense, all of these are
similar:
8
8 + 3
Rod(length = 9, color = 'blue')
In all these cases, the resulting object gets a name only if it's the RHS of
an assignment. If not, the object disappears (from the user's viewpoint,
anyway) as soon as the containing statement/expression is executed.
Also, what do you say to the student who points out that "8 is a name"
violates the rule that Python names must begin with a letter or underscore?
-John
More information about the Edu-sig
mailing list