module confusion
Steve Holden
steve at holdenweb.com
Wed Oct 3 22:22:57 EDT 2007
Lawrence D'Oliveiro wrote:
> In message <874ph8sdhx.fsf at benfinney.id.au>, Ben Finney wrote:
>
>> Lawrence D'Oliveiro <ldo at geek-central.gen.new_zealand> writes:
>>
>>> On my Gentoo system:
>>>
>>> >>> import os
>>> >>> os.path
>>> <module 'posixpath' from '/usr/lib64/python2.5/posixpath.pyc'>
>>>
>>> It's just a variable that happens to point to the posixpath module.
>> There's no "pointing" going on. It's another name bound to the same
>> object, of equal status to the 'posixpath' name.
>>
>> Python doesn't have pointers, and even "variable" is a misleading term
>> in Python. Best to stick to "name" and "bound to".
>
> In Python, all names _are_ variables. They are not "bound" to objects. The
> value of os.path is a pointer. It's implemented as a pointer, it has all
> the semantics of a pointer.
>
> Honestly, why do people react to the word "pointer" as though computers have
> to wear underwear to conceal something shameful going on in their nether
> regions?
Because they have been told by their church that all God-fearing names
do what names have always done in programming languages, which is to
describe areas of memory of a particular size, type and locality.
You and I know that the semantics of Python names are precisely those of
(to use an Algol 68 term, unless I am mistaken) automatically
dereferenced pointers to objects of arbitrary type. I actually think
that's one of the neatest things about Python, and I believe it's no
accident that both Tim Peters and I were Icon enthusiasts.
But the rest of the world clings to its illusions.
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
Sorry, the dog ate my .sigline
More information about the Python-list
mailing list