On 5/10/07, Ben Bangert <[EMAIL PROTECTED]> wrote:
>
> Spider wrote:
> > Python guru Fredrik Lundh has an article at 
> > http://effbot.org/zone/import-confusion.htm
> > in which he discusses use of the import statement. He says,
> > essentially :
> >    "import X" should be the normal method of importing
> >    "from X import *" is bad practice
> >    "from X import Y" is sometime ok
> > That seems to be the general agreement in the python world.
> >
> This decision was explicitly made, and I have no intention of changing
> it in the Pylons defaults in the future. The main reason for this is for
> both DRY and for ease of use. You need several things in all your
> controllers, why should you import them over and over again in every
> single controller?

Hear, hear.  lib.base is really a special case because if you copy all
those dozen import lines into every controller, you'll have to change
all of them if something moves or you add something.  Better to
consider them a common denominator of symbols available in every
controller.

The main problem comes with packages that export dozens of symbols
like SQLAlchemy.  I tried "import sqlalchemy as sa" and ultimately
went to importing each symbol as  I need it.

-- 
Mike Orr <[EMAIL PROTECTED]>

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

Reply via email to