himanshu14 / django-survey

Automatically exported from code.google.com/p/django-survey
0 stars 0 forks source link

Don't use "local" imports #9

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Not sure if local is the right word.  Looking at:

http://code.google.com/p/django-survey/source/browse/trunk/survey/views.py?r=18

Pretty sure the best convention here to use the package name like 

from survey.models import Survey, ...

rather than:  

from models import Survey, ...

Original issue reported on code.google.com by mand...@gmail.com on 28 May 2008 at 5:01

GoogleCodeExporter commented 8 years ago
Fix committed in r38.

Original comment by yann.ma...@gmail.com on 28 May 2008 at 9:16

GoogleCodeExporter commented 8 years ago
NOTE: The convention is moving to local imports over package named imports for
reusable apps. For instance one client of django-survey has all their 3rd party 
apps
under 'externals' and imports those apps as externals.survey.models

This means that they have to edit our imports to use the prefix 'externals.'
In general when doing package development in python, local imports are 
preferred over
absolute as you do not have control over what 'absolute' actually is.

Original comment by doug.nap...@gmail.com on 29 May 2008 at 7:33

GoogleCodeExporter commented 8 years ago
no shit ... news to me.  When I went to the python conference in Chicago this 
year,
all I heard was that local imports are evil.  But I guess it all depends.  

I also thought one of the basic tenants of app development is that the app 
should
always sit on the python path.  I wonder what ubernostrum's take is on this 
because
releases (django-registration, django-profiles) use package based imports.  And 
those
apps have been around for a long time, he is also a core maintainer and gets 
paid to
work on Django from the what I know. 

Original comment by mand...@gmail.com on 29 May 2008 at 7:47

GoogleCodeExporter commented 8 years ago
I am sorry but since I am not sure what you are talking about on the theoretical
level. It would be great if someone could look at the modification I have done 
r38
and let me know  if I should role them back.

Thank you

Original comment by yann.ma...@gmail.com on 30 May 2008 at 9:52