python development practices?

John Thingstad john.thingstad at chello.no
Wed Oct 31 04:13:42 EST 2001


>While I feel that Python makes me far more productive as a programmer
>for all the projects on which i've worked, i'm inclined to agree that
>the lack of data hiding coupled with lack of a standard interface
>specification would cause problems in a team.

Python does have a simple data hiding scheme.

class Something:
  def __init():
      __name = 'hidden'

makes name local to that class. (It can be accessed by writing __Something_name though)
The same can be done for module classes, functions etc.

Also hiding at the package level with the __all__ modifier
As in

file __init__.py

__all__ = ["export1", "export2"]

will only export export1 and export2 modules.






More information about the Python-list mailing list