[openstack-dev] Dropping or weakening the 'only import modules' style guideline - H302

Dan Smith dms at danplanet.com
Wed Apr 9 19:50:36 UTC 2014


>> So I'm a soft -1 on dropping it from hacking.

Me too.

> from testtools import matchers
> ...
> 
> Or = matchers.Or
> LessThan = matchers.LessThan
> ...

This is the right way to do it, IMHO, if you have something like
matchers.Or that needs to be treated like part of the syntax. Otherwise,
module-only imports massively improves the ability to find where
something comes from.

I also think that machine-enforced style, where appropriate, is very
helpful in keeping our code base readable. Repeated patterns and style
help a lot, and anything that can be easily machine-enforced is a win in
my book.

--Dan



More information about the OpenStack-dev mailing list