Hi Galago,

For some conventions see 
http://docs.djangoproject.com/en/dev/internals/contributing/?from=olddocs#django-conventions
and http://www.python.org/dev/peps/pep-0008/

Generally I do imports at the top of the module in this order (with a blank 
line inbetween):

1.       python modules

2.       django modules

3.       3rd party modules

4.       Your project/application modules

Regards
Chris

From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of galago
Sent: 16 February 2011 10:39
To: django-users@googlegroups.com
Subject: Importing modules in code

Is it a good idea to import modules in the middle of the code, and not on the 
beginning?
I want to make a hash generation. It's few lines - it's used once in all 
application. Should I import hashlib just on the beginning of the file? Now I 
put it with the rest of the code.
Is it bad?

I don't want to import it with all requests in my app view.
--
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to