It sometimes bothers me how often the package name of a TG project is
repeated in a controller module, both in import statements like "from
mylongpackagename.model import MyModelClass" and in expose decorators
like @expose("mylongpackagename.templates.mypage").
So I thought about changing the quickstart templates to use relative
imports, but I found two problems:
1) Relative imports do not work for Genshi (generally dotted notation)
in @expose any more (they used to work in TG1), so we would first need
to add that feature back.
2) I read e.g. in PEP8 that relative imports are considered bad
practice, not only the old implicit relative imports (which is obvious),
but even the newer explicit relative imports. Unfortunately no rationale
is given, I can only guess that it's about "explicit better than
implicit" (since explicit relative imports are only explicit about being
relative, the location is still implicit). I'm not sure whether
"explicit better than implicit" overtrumps DRY here. And I don't
understand why explicit relative imports have been introduced in Python
2 and not been removed from Python 3 if they are really so bad.
Opinions?
-- Christoph
--
You received this message because you are subscribed to the Google Groups
"TurboGears Trunk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/turbogears-trunk.
For more options, visit https://groups.google.com/groups/opt_out.