If I might offer one small comment... It seems to me that this argument also goes to a code readability issue; ergo, if you choose "from foobar..." as opposed to "import foobar", then from that point on you only need employ foobar's methods in your code, and they are not alway easily recognizable. i.e, by importing foobar, you will always prefix a method with its' parent module name, which [I think] makes the code more understandable.
>From the virtual desk of Lowell Tackett --- On Sat, 1/9/10, Alan Gauld <alan.ga...@btinternet.com> wrote: From: Alan Gauld <alan.ga...@btinternet.com> Subject: Re: [Tutor] Question on "import foobar" vs "from foobar import *" To: tutor@python.org Date: Saturday, January 9, 2010, 10:21 AM "Rob Cherry" <pythontu...@lxrb.com> wrote > Extending on this advice somewhat - is it *ever* correct to "import foobar". Yes, it is *usually* correct to "import foobar" and rarely correct to "from foobar". The exception being if you only need one or two names from foobar, but usually you need a lot more, in which case use import foobar. To save typing you can give foobar a shorter name: import foobar as fb For some reason that convenience feature doesn't get mentioned all that often but I use it a lot. HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor