Ten Essential Development Practices
Robert Kern
rkern at ucsd.edu
Thu Jul 28 18:35:54 EDT 2005
Michael Hoffman wrote:
> Aahz wrote:
>
>>>One of these days I'm going to figure out how to embody "Namespaces are
>>>one honking great idea -- let's do more of those!" Then I shall be
>>>enlightened.
>>
>>What don't you understand about it? (This is a serious question -- I
>>can think of several answers to give you, but want to know what focus is
>>needed first.)
>
> I wasn't expecting a serious answer to this, but here goes.
>
> First, I wasn't a Python user when namespaces were introduced. It's hard
> for me to even imagine Python without namespaces. Did imported modules
> just go into the same namespace as everything else? Yuck. It's too bad
> this happened before there were PEPs so I could understand the design
> and what came before.
I'm pretty sure that namespaces are fundamental to the design of Python.
I don't think there was any "before namespaces."
> Is it the fact that Python is unimaginable without namespaces that makes
> them such a honking great idea? Aren't they somewhat of an obvious idea?
> Several other languages have them.
>
> Was the implementation of namespaces easy or hard to explain?
It isn't just that Python has namespaces, but that they are the
implementation for quite a lot of things. Modules: namespaces. Classes:
namespaces. Instances: namespaces. Scope: namespaces. It's a very
elegant way to handle a broad class of language features very consistently.
That said, I made a boo-boo. The Zen of Python is really a set of design
principles (and some of them, like this one, are more specifically
*language* design principles), not Essential Development Practices.
That'll teach me to not RTFA.
--
Robert Kern
rkern at ucsd.edu
"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter
More information about the Python-list
mailing list