[openstack-dev] H302 considered harmful
John Griffith
john.griffith8 at gmail.com
Wed Feb 25 20:04:49 UTC 2015
On Wed, Feb 25, 2015 at 12:59 PM, Robert Collins <robertc at robertcollins.net>
wrote:
> On 26 February 2015 at 08:54, melanie witt <melwittt at gmail.com> wrote:
> > On Feb 25, 2015, at 10:51, Duncan Thomas <duncan.thomas at gmail.com>
> wrote:
> >
> >> Is there anybody who'd like to step forward in defence of this rule and
> explain why it is an improvement? I don't discount for a moment the
> possibility I'm missing something, and welcome the education in that case
> >
> > A reason I can think of would be to preserve namespacing (no possibility
> of function or class name collision upon import). Another reason could be
> maintainability, scenario being: Person 1 imports ClassA from a module to
> use, Person 2 comes along later and needs a different class from the module
> so they import ClassB from the same module to use, and it continues. If
> only the module had been imported, everybody can just do module.ClassA,
> module.ClassB instead of potentially multiple imports from the same module
> of different classes and functions. I've also read it doesn't cost more to
> import the entire module rather than just a function or a class, as the
> whole module has to be parsed either way.
>
> I think the primary benefit is that when looking at the code you can
> tell where a name came from. If the code is using libraries that one
> is not familiar with, this makes finding the implementation a lot
> easier (than e.g. googling it and hoping its unique and not generic
> like 'create' or something.
>
> -Rob
>
> --
> Robert Collins <rbtcollins at hp.com>
> Distinguished Technologist
> HP Converged Cloud
>
> __________________________________________________________________________
> OpenStack Development Mailing List (not for usage questions)
> Unsubscribe: OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
I'd echo Melanie and Roberts points as being benefits. I've actually
recently encountered the name space collision problem pointed out in
Melanies example, but most of all I agree with Roberts points about being
"explicit". Not to mention we can avoid what we have today where the same
module is imported under 5 different names (that's annoying).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20150225/679db520/attachment.html>
More information about the OpenStack-dev
mailing list