[Python-Dev] Deprecate __ private (was Re: PEP 8 updates/clarifications)
François Pinard
pinard at iro.umontreal.ca
Tue Dec 13 15:53:13 CET 2005
[Steven Bethard]
>Ahh. I never run into this because I never import objects directly
>from modules. So, instead of:
> from elementtree.ElementTree import ElementTree
> ...
> ElementTree(...)
>I almost always write something like:
> import elementtree.ElementTree as et
> ...
> et.ElementTree(...)
This is a bit off-topic, but I felt like sharing our experience. One
consultant we once hired here was doing exactly that (importing over
two-letter abbreviations).
>Thus, all objects that were imported from external modules are always
>immediately identifiable as such by their prefixed module name. I do
>see though that if you like to import the objects directly from the
>module this could be confusing.
Everybody here agrees that this style makes the code much less legible.
Partly because of the constant indirection. Also because it imposes
learning all those two-letter abbreviations before reading a module, and
the learning has to be redone on each visit, it just does not stick.
So, we try to routinely replace abbreviations with the real names
whenever we have to play in one module written by this consultant. But
it only goes a little bit at a time. We should probably suffer taking
the time, dive in it all, and get rid of this style once and for all...
--
François Pinard http://pinard.progiciels-bpi.ca
More information about the Python-Dev
mailing list