difference between import from mod.func() and x=mod.func()

Hari Sekhon sekhon.hari at googlemail.com
Wed Jun 21 12:38:23 CEST 2006


I take it that it's not worth listening to that tutorial and just using good
old "import from", which I suspect is better anyway since it imports less...

"uneducated premature optimisation" - I take it this is insulting a that
programmer's progexuality...!



"import from" it is then unless anybody has anything else to say on the
matter.


Thanks

Hari


On 20/06/06, Fredrik Lundh <fredrik at pythonware.com> wrote:
>
> Hari Sekhon wrote:
>
> > What is the difference in terms of efficiency and speed between
> >
> > from os import path
> >
> > and
> >
> > import os
> > path=os.path
>
> the only difference is that the former only sets the "path" variable,
> while the
> latter leaves both "os" and "path" in your namespace.
>
> > I would think that the import from would be better, just curious since I
> > read somewhere on the web, some guy's code tutorial where he did the
> > latter and said it was for efficiency/speed.
>
> sounds like "uneducated premature optimization" to me.
>
> </F>
>
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060621/66502c31/attachment.html>


More information about the Python-list mailing list