[Tutor] "from this import *" or "import this"

Patrick K. O'Brien pobrien@orbtech.com
Sun, 2 Dec 2001 16:13:24 -0600


You have a perfectly good grasp on the situation. Avoid import * for all the
reasons you cite, unless you don't really have a choice. For example, the
wxPython gui toolkit pretty much requires you to do "from wxPython.wx import
*". The good thing is that the wxPython folks are fully aware of the issues
and do what they can to minimize problems. One example is that all
wx-related things are prefixed with "wx" to avoid naming conflicts.

---
Patrick K. O'Brien
Orbtech.com - Your Source For Python Development Services


> -----Original Message-----
> From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of
> Jean Montambeault
> Sent: Sunday, December 02, 2001 9:02 AM
> To: tutor@python.org
> Subject: [Tutor] "from this import *" or "import this"
>
>
>     Be ready for a whole lot of very newbie questions. I've never
> programmed
> before and do not intend to make a career out of what I am learning : pure
> amateurism here which does not necessarily implies triviality but that
> shouldn't be a surprise.
>
>     So :
>         is there a real use for the form "from this_module import
> * " since
>                 (a) there seems to be a real danger to get some
> functions or
> variables which would have the same name if more than one module are open
> that way
>                 (b) nothing shows the relation to the module which is to
> some extent documenting the program
>                 (c) it imports the whole module (I guess) just as "import
> this_module" seems to be doing
>         ?
>         Or is it much safer and wiser to avoid using it ?
>
>         Thanks
>
>        Jean M.
>
>
>
>
>
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor