[Ml-yokadi] Coding style nitpick
Aurélien Gâteau
aurelien.gateau
Ven 5 Déc 00:13:00 CET 2008
Hi,
Right now Yokadi code oscillates between code importing modules like this:
import foo
foo.bar()
and code importing modules like this:
from foo import bar
bar()
As Pythoneers like to say, "Explicit is better than implicit". I much
prefer the first version to the second one. Using "from foo import bar"
hides the fact that "bar()" comes from "foo", which makes code less
readable and more prone to name conflicts IMHO.
Note that this is only true for namespace-like modules. For modules
which only provide one class, I consider it ok to write this:
from someclass import SomeClass
x=SomeClass()
Rather than:
import someclass
x=someclass.SomeClass()
Which would be useless duplication.
I know this can be painful for os.path functions, though. Maybe it would
be a good idea to use the wonderful path.py module instead :)
Sorry for being annoying, I should probably have written this earlier.
Aurélien
Plus d'informations sur la liste de diffusion Ml-yokadi