On Nov 7, 2007 8:50 AM, Christoph Zwerschke <[EMAIL PROTECTED]> wrote:

>
> Florent Aide wrote:
> > I would like to propose something for our coding standards: I would
> > like to ban "import *" from our code and impose the use of explicit
> > import everywhere.
> > This will greatly enhance readability and maintenability in the long
> run.
> >
> > Any suggestions?
>
> Good idea. Some of them seem to be even completely unnecessary, such as
> "from turbojson.jsonify import *" in saprovider.py.
>
> One special case are the imports from sqlobject, sqlalchemy and elixir
> in model.py. In this case, importing * makes some sense.


I disagree on model.  It's one thing to say, "Yes, these well-known,
supported, redistributable modules support the __all__ convention, and we
know they will in the future."  But it's another thing to say, "we're going
to quickstart your application in a way that says you are hereby ordered to
use the __all__ convention in your internal code and keep it up-to-date".

For example, I've been burned more than once by the "from datetime import
datetime" that's auto-generated in model.py and leaked into the controller
namespace via importing *.  Sure, that issue would be solved by using
__all__, but I think it's asking too much to force every user to keep an
__all__ up-to-date for a file that isn't necessarily intended for reuse.

-- 
Tim Lesher <[EMAIL PROTECTED]>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears Trunk" group.
To post to this group, send email to turbogears-trunk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears-trunk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to