Re: use import *

2016-08-01 Thread Lawrence D’Oliveiro
On Tuesday, August 2, 2016 at 3:32:11 AM UTC+12, Ganesh Pal wrote: > is it a good programming practice to use import * ? No. Think of the module you’re importing as a can, and each of the names it defines as a worm. So you when you do “from «module» import *”, it’s like emptying all the wo

Re: use import *

2016-08-01 Thread Thomas 'PointedEars' Lahn
Ganesh Pal wrote: > is it a good programming practice to use [from … ] import * ? No; but it is not as harmful as one would think either. <https://docs.python.org/3/tutorial/modules.html#importing-from-a-package> > if answer is "NO " then are there situation where

Re: use import *

2016-08-01 Thread Chris Angelico
tter than implicit.' > > > I had a question on the above example > > 1. I haven't used " from menagerie.cat.models import * is it a good > programming practice to use import * ? if answer is "NO " then are > there situation where you are forced to us

Re: use import *

2016-08-01 Thread Ian Kelly
int 'Explicit is better than implicit.' These aren't equivalent. The first implies the existence of the package "menagerie.cat.models" while the second implies the existence of "menagerie.models.cat". > I had a question on the above example > > 1. I haven

use import *

2016-08-01 Thread Ganesh Pal
import * is it a good programming practice to use import * ? if answer is "NO " then are there situation where you are forced to use import * Regards, Ganesh -- https://mail.python.org/mailman/listinfo/python-list

Re: when to use import statements in the header, when to use import statements in the blocks where they are used?

2012-02-10 Thread Arnaud Delobelle
On 8 February 2012 01:48, Lei Cheng wrote: > Hi all, > >    In a py file, when to use import statements in the header, when to use > import statements in the blocks where they are used? >    What are the best practices? >    Thanks! Aside from other answers: in some rare cases

Re: when to use import statements in the header, when to use import statements in the blocks where they are used?

2012-02-08 Thread Steven D'Aprano
On Tue, 07 Feb 2012 21:41:49 -0500, Dave Angel wrote: > On 02/07/2012 09:32 PM, Patto wrote: >> However I find in the file path/to/djcelery/loaders.py from >> django-celery source, there are so many import/from statements used >> inside functions, I do not know why the author coded like this. Are

Re: when to use import statements in the header, when to use import statements in the blocks where they are used?

2012-02-08 Thread Mark Lawrence
48 PM, Lei Cheng wrote: Hi all, In a py file, when to use import statements in the header, when to use import statements in the blocks where they are used? What are the best practices? Thanks! Pat Best practice is to put all the imports at the beginning of the module, so they are easy to spot. I

Re: when to use import statements in the header, when to use import statements in the blocks where they are used?

2012-02-07 Thread Dave Angel
In a py file, when to use import statements in the header, when to use import statements in the blocks where they are used? What are the best practices? Thanks! Pat Best practice is to put all the imports at the beginning of the module, so they are easy to spot. If you put an import ins

Re: when to use import statements in the header, when to use import statements in the blocks where they are used?

2012-02-07 Thread Patto
Dave Angel: On Wed, Feb 8, 2012 at 10:05 AM, Dave Angel wrote: > On 02/07/2012 08:48 PM, Lei Cheng wrote: > >> Hi all, >> >> In a py file, when to use import statements in the header, when to use >> import statements in the blocks where they are used? >

Re: when to use import statements in the header, when to use import statements in the blocks where they are used?

2012-02-07 Thread Dave Angel
On 02/07/2012 08:48 PM, Lei Cheng wrote: Hi all, In a py file, when to use import statements in the header, when to use import statements in the blocks where they are used? What are the best practices? Thanks! Pat Best practice is to put all the imports at the beginning of the

when to use import statements in the header, when to use import statements in the blocks where they are used?

2012-02-07 Thread Lei Cheng
Hi all, In a py file, when to use import statements in the header, when to use import statements in the blocks where they are used? What are the best practices? Thanks! Pat -- http://mail.python.org/mailman/listinfo/python-list