[Tutor] New Python scoping

Tommy Butler python.tutor@atrixnet.com
Sun, 4 Nov 2001 22:48:00 -0800


One of the reasons I haven't really used Python a lot in the past is beca=
use of
the difficulty in creating enforced capsulation of both variables and met=
hods in
Python objects.

Forgive me for not really understanding what the philosophy behind this p=
aradigm
really is.  I am very curious about why this is so, and if the new scopin=
g rules
for the latest version of Python change this in any way.

The discussion of these new rules in the release notes at Python.org left=
 me a
bit confused.  I'm sure that  my lack of substantial experience with Pyth=
on has
much to do with that.

So my questions are thus--

   a)  what ways can one create encapsulated, private
       routines and/or variables in a Python object...

   b)  Is such a thing really even necessary?

   c)  Wouldn't namespace conflicts arise?  Do you have
       to make a new object every time you need a new
       namespace?

   d)  Has a new reasoning been adopted within the Python
       community about scoping issues? Is this the driving
       factor behind the changes?

   e)  Do Python's new scoping rules change the design
       paradigm and coding methodologies for OO
       programming in Python?  If yes, how so?

   f)  Can someone explain Python scoping rules in general
       for me, taking into account these new changes?


    Tommy Butler
    Internet Strategies, Inc.   Everything is Possible

      web     http://www.istrat.com
      email   mailto:tommy@istrat.com
      tel     214=B7393=B71000  ext 207
      fax     800=B7307=B78105

    2200 North Lamar, Suite 307      Dallas, TX  75202