[Tutor] globals( ) and binding doubt (newbie) !
Karthik Gurumurthy
karthikg@aztec.soft.net
Tue, 8 Jan 2002 22:03:48 +0530
for a moment i totally forgot about the reference semantics and got too
drawn into globals and "name" look up and stuff like that :-)
am doing quite a bit of python reading these days.
a,b,c were refering to 3 objects
i added them to a list
then i made a,b and c point to different objects
and expected the list to point to the ones initialized last
which is wrong.
I got confused because i was looking at the globals() which reflected the
change.
The earlier objects are obviously not garbage collected since the lists were
holding on to
references to them.
uhhm.
thanks
karthik.
-----Original Message-----
From: Kirby Urner [mailto:urnerk@qwest.net]
Sent: Tuesday, January 08, 2002 9:13 PM
To: Karthik Gurumurthy
Cc: tutor@python.org; python-list@python.org
Subject: Re: [Tutor] globals( ) and binding doubt (newbie) !
Importance: High
>
>thanks for your patience!
>karthik
Not exactly sure what's going on here, but note that
if you don't explicity return a value from a function
(print a doesn't count -- that's not returning), the
the function returns None.
In the examples you give, your functions behave as
they were defined, by returning None.
Kirby