[Python-Dev] Great Renaming? What is the goal?

Ken Manheimer klm@digicool.com
Mon, 27 Mar 2000 13:31:01 -0500 (EST)


On Mon, 27 Mar 2000, Jeremy Hylton wrote:

> >>>>> "PF" == Peter Funk <pf@artcom-gmbh.de> writes:
> 
>   PF> That is even worse.  So not only the 'import' sections, which I
>   PF> usually keep at the top of my modules, have to be changed: This
>   PF> way for example 're.compile(...' has to be changed into
>   PF> 'text.re.compile(...' all over the place possibly breaking the
>   PF> 'Maximum Line Length' styleguide rule.
> 
> There is nothing wrong with changing only the import statement:
>     from text import re
> 
> The only problematic use of from ... import ... is
>     from text.re import *
> which adds an unspecified set of names to the current namespace.

Actually, i think there's another important gotcha with from .. import
which may be contributing to peter's sense of concern, but which i don't
think needs to in this case.  I also thought we had discussed providing
transparency in general, at least of the 1.x series.  ?

The other gotcha i mean applies when the thing you're importing is a
terminal, ie a non-module.  Then, changes to the assignments of the names
in the original module aren't reflected in the names you've imported -
they're decoupled from the namespace of the original module.

When the thing you're importing is, itself, a module, the same kind of
thing *can* happen, but you're more generally concerned with tracking
revisions to the contents of those modules, which is tracked ok in the
thing you "from .. import"ed.

I thought the other problem peter was objecting to, having to change the
import sections in the first place, was going to be avoided in the 1.x
series (if we do this kind of thing) by inherently extending the import
path to include all the packages, so people need not change their code?  
Seems like most of this would be fairly transparent w.r.t. the operation
of existing applications.  Have i lost track of the discussion?

Ken
klm@digicool.com