[Python-ideas] Namespaces and modules [was Deprecate the round builtin]
Steven D'Aprano
steve at pearwood.info
Mon Oct 1 08:05:51 CEST 2012
On Sun, Sep 30, 2012 at 11:46:05PM -0500, Mark Adam wrote:
> On Thu, Sep 27, 2012 at 5:23 AM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> > Presumably they would be implemented as module objects,
> > created automatically at interpreter startup instead of
> > being loaded from a file.
> >
> > In which case "built-in module" might be a better term
> > for them. And their names should start with lower case.
>
> That's cool. YES, lowercase.
I'm not sure why "built-in module" is a better term for something which
I gather is a separate namespace within a module, so you can have:
module.spam # global namespace
module.sub.spam # sub is a "submodule" or "namespace"
but sub has no independent existence as a file on disk. If that's what
we're discussing, I don't think that "built-in module" is a good name,
since it isn't *built-in*.
We already have something called "built-in modules" -- modules like sys
which actually are built-in to the Python virtual machine.
> > Also you wouldn't need new syntax to get names out of
> > them, just the existing import machinery:
> >
> > from numbers import *
>
> Well, to me there must be a clear partitioning.
>
> The stuff in the builtin [module] sets the tone for the whole
> interpreter environment (and I think python culture itself). If one
> were to use the standard import language (like in your example), it
> confuses one "semantically" -- because you're suggesting to treat a it
> (i.e. a whole class of "things") as something optional.
>
> Does that make sense?
Not to me, I'm afraid.
--
Steven
More information about the Python-ideas
mailing list