Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use "local" imports #9

Closed
GoogleCodeExporter opened this issue Dec 23, 2015 · 4 comments
Closed

Don't use "local" imports #9

GoogleCodeExporter opened this issue Dec 23, 2015 · 4 comments

Comments

@GoogleCodeExporter
Copy link

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
Copy link
Author

Fix committed in r38.

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

  • Changed state: Fixed

@GoogleCodeExporter
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant