unexpected behavior: did i create a pointer?

Steve Holden steve at holdenweb.com
Fri Sep 7 15:19:12 EDT 2007


Grant Edwards wrote:
> On 2007-09-07, Peter Otten <__peter__ at web.de> wrote:
>> Am Fri, 07 Sep 2007 10:40:47 +0000 schrieb Steven D'Aprano:
>>
>>> Python doesn't have any pointers.
>> Thinking of python variables or "names" as pointers should
>> get you a long way when trying to understand python's behaviour.
> 
> But thinking of them as names bound to objects will get you
> further (and get you there faster). ;)
> 
True.

Since it's only a matter of time before someone brings up the "post-It" 
analogy, let me cavil in advance about it. The thing I don't like about 
that particular pedagogic mechanism is that it always "attaches" the 
names to the objects.

To me that blurs the fact that the names live strictly inside 
namespaces, and are destroyed (along with the references they make to 
other objects) when the namespace goes out of scope or otherwise ceases 
to exist (instance destruction being the obvious one).

I only mention this because I too can be a pedantic little bugger when I 
want to be. Have a nice day.

regards
  Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC/Ltd           http://www.holdenweb.com
Skype: holdenweb      http://del.icio.us/steve.holden
--------------- Asciimercial ------------------
Get on the web: Blog, lens and tag the Internet
Many services currently offer free registration
----------- Thank You for Reading -------------




More information about the Python-list mailing list