module confusion
Lawrence D'Oliveiro
ldo at geek-central.gen.new_zealand
Thu Oct 4 00:44:38 EDT 2007
In message <mailman.1487.1191456788.2658.python-list at python.org>, Carsten
Haese wrote:
> On Thu, 2007-10-04 at 11:11 +1300, Lawrence D'Oliveiro wrote:
>
>> In Python, all names _are_ variables. They are not "bound" to objects.
>> The value of os.path is a pointer.
>
> No. "os.path" refers to the object that's known as the "path" attribute
> of the object known as "os". That object, in turn, is a module.
No, it's a variable. It just happens to contain a pointer to a module.
>> It's implemented as a pointer,
>
> While it is true that namespaces are implemented in CPython as
> collections of pointers to PyObject structures, that's an irrelevant
> implementation detail. I doubt that they are implemented as pointers in
> Jython, PyPy, or IronPython.
I'll bet they are.
>> it has all the semantics of a pointer.
>
> No, it doesn't. A pointer means the physical address of a memory
> location, which implies that you can overwrite that memory location. Can
> you do that in Python?
Yes. Look up the definition of "mutable objects".
More information about the Python-list
mailing list