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
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
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
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
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
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
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
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
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
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?
>
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
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
12 matches
Mail list logo