module confusion

Ben Finney bignose+hates-spam at
Wed Oct 3 12:23:38 CEST 2007

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".

 \                "Crime is contagious ... if the government becomes a |
  `\    lawbreaker, it breeds contempt for the law."  -- Justice Louis |
_o__)                                                         Brandeis |
Ben Finney

More information about the Python-list mailing list