Encapsulation in Python
Gregory Ewing
greg.ewing at canterbury.ac.nz
Fri Mar 11 19:52:22 EST 2016
Rick Johnson wrote:
> I have witnessed the mayhem that occurs when a language does
> not mandate module encapsulation (Ruby, i'm looking directly
> at you!!!!), and while i agree with the Python designers
> that modules must *ALWAYS* be mandatory, i am not convinced
> that module space should be so strictly confined to source
> files.
Well, I am. When looking at someone else's code, it's
very useful to be able to take a name used in one source
file and easily find the file where it's defined. That's
very easy to do in Python, and very hard to do in languages
that don't relate namespaces and source files.
The experiences I base this on aren't confined to Python.
This is one of the very few things that I think Java got
right, and some of the other JVM-based languages -- such
as Scala -- got wrong.
--
Greg
More information about the Python-list
mailing list