On Sat, Aug 30, 2008 at 4:53 PM, Eric Wertman <ewertman@gmail .comwrote:
>
>
My opinion is that this is the preffered way, generally speaking. Not
only does it avoid namespace issues as effbot pointed out, but it also
makes code easier to read later. As examples, I tend to break those
rules frequently with these :
>
from pprint import pprint # Because pprint.pprint is just redundant
from lxml import etree # Actually I guess this doesn't break the rule.
from datetime import datetime # This might be a bad idea... I haven't
had problems yet though. datetime.dateti me gets on my nerves though.
>
just my .02
>
Eric
--
>
Thanks Eric; your 02 cents are worthy for me ;)
Regards
Marco
--
Marco Bizzarri
>I read the PEP8 and the "importing Python Modules" article. However,
>I'm still a little confused on what should the general rules for
>importing modules.
>>
>I'm showing what I used in my current project, and will accept your
>advices on how I should change them.
>I'm still a little confused on what should the general rules for
>importing modules.
>>
>I'm showing what I used in my current project, and will accept your
>advices on how I should change them.
>import module
>>
>and then use
>>
>module.MyCla ss
>>
>( in case of a flat module)
>>
>or
>>
>from package.subpack age import module
>>
>and then use
>>
>module.MyCla ss
>>
>(( for a package/subpackage structure ))
>>
>and then use
>>
>module.MyCla ss
>>
>( in case of a flat module)
>>
>or
>>
>from package.subpack age import module
>>
>and then use
>>
>module.MyCla ss
>>
>(( for a package/subpackage structure ))
My opinion is that this is the preffered way, generally speaking. Not
only does it avoid namespace issues as effbot pointed out, but it also
makes code easier to read later. As examples, I tend to break those
rules frequently with these :
>
from pprint import pprint # Because pprint.pprint is just redundant
from lxml import etree # Actually I guess this doesn't break the rule.
from datetime import datetime # This might be a bad idea... I haven't
had problems yet though. datetime.dateti me gets on my nerves though.
>
just my .02
>
Eric
--
>
Regards
Marco
--
Marco Bizzarri