On 8 Sep 2005 22:48:05 -0700 "Johnny Lee" <[EMAIL PROTECTED]> wrote: > I thought there must be something special when you named a VAR with > '_' the first character. Maybe it's just a programming style and I had > thought too much...
It is just a programming style issue. In Python, variables and functions beginning with '_' are regarded by convention to be semi-private; essentially the Python equivalent of 'protected'. Since Python has no formal access specifications, conventions like this have been adopted. Likewise, '__' is private. Code using your code can bypass this, of course, but it's just a signal to the programmer 'avoid using this; it is an internal detail that may change.' Incidentally, epydoc regards all items beginning with '_' as private, and hides them from the public documentation it generates. And, in one project I'm working on, I use underscores to base/background/helper modules in a mechanism where modules are dynamically loaded (to prevent name collisions, since no dynamically loaded module will begin with an underscore). - Michael -- http://mail.python.org/mailman/listinfo/python-list