Nested function scope problem

Slawomir Nowaczyk slawomir.nowaczyk.847 at student.lu.se
Sun Aug 6 05:41:27 EDT 2006


On Fri, 04 Aug 2006 13:42:59 -0300
Gerhard Fiedler <gelists at gmail.com> wrote:

#> On 2006-08-04 12:12:44, Antoon Pardon wrote:
#> 
#> >>> You can hardly claim that what gets printed is the "id" of the variable c.
#> >>> (Well, you can claim, but few C programmers would follow you.)
#> >>
#> >> That's possible. I wouldn't expect too many C programmers to have any
#> >> notion of "id of a variable". I, for example, never thought about such
#> >> thing before this thread.
#> > 
#> > But even in Python we don't speak of "id of a variable". It is not the
#> > variable that has an id. It is the object that is currently attached to
#> > the variable that has an id. Yes we can use "id of a variable" as a
#> > shortcut for the correct formulation as long as you keep in mind that it
#> > is not the variable itself that has an id.
#> 
#> This sounds a bit like saying "yes we can use the term 'variable' as a
#> shortcut for the correct formulation (object associated to a name) as long
#> as we keep in mind that it is not actually a variable" :)

No it doesn't.

Anyway, where did the idea that "id(a)" is an "id of a variable a"
come from, anyway? Since Python doesn't (supposedly) have variables,
it couldn't have come from Python. Since C doesn't have id(), it
couldn't have come from C... So?

Obviously, if we use pythonic terminology of "binding", a statement
would be that id(a) "is an id of a binding", which doesn't make much
sense. 

Antoon is right, id(a) is an identifier _of an object bound to a_.

Which translates into C++ as "an object pointed to by a", IMHO.

-- 
 Best wishes,
   Slawomir Nowaczyk
     ( Slawomir.Nowaczyk at cs.lth.se )

If at first you do succeed, try not to look astonished.




More information about the Python-list mailing list