* Cédric Krier: " [tryton-dev] New __init__ style" (Wed, 24 Aug 2016 12:59:25
+0200):
> Hi,
>
> Since some time, I'm a little bit annoyed by our exception about
> "import *" in __init__.py. It will be great if we could have no more
> those warning.
> So I propose to gradually change our style to use this one (example from
> party module):
>
> import category
> import party
> …
>
> def register():
> Pool.register(
> category.Category,
> party.Party,
> party.PartyCategory,
> …)
>
> I find that it has three advantages:
>
> - remove the "import *"
> - remove collision risk about class name
> - show which python file comes a class
>
> What do you think?
Alternative:
from category import Category
from party import Party, PartyCategory
...
def register():
...no need to change
While this should meet all three advantages cited above as well, it has for me
the additional advantage of a more accustomed view of imports.
--
Mathias Behrle
MBSolutions
Gilgenmatten 10 A
D-79114 Freiburg
Tel:
+49(761)471023
Fax:
+49(761)4770816
http://www.m9s.biz
UStIdNr: DE 142009020
PGP/GnuPG key availabable from any keyserver, ID: 0xD6D09BE48405BBF6
AC29 7E5C 46B9 D0B6 1C71 7681 D6D0 9BE4 8405 BBF6