[Pythonmac-SIG] importing namespaces/modules
David Worrall
vip at avatar.com.au
Fri Jan 19 07:11:57 CET 2007
Hello all,
I've got a query which is probably obvious for people more
experienced than I
but I can't find any exact reference to it elsewhere.
It's not mac specific, but hey, I already belong to too many dev
groups... :-)
The discussion at http://docs.python.org/tut/node11.html is OK but it
doesn't really answer my query.
I note that increasingly programmers are deprecating
>>> from module import *
in favour of
>>> import module
which is fair enough, as explicit attributes make code more readable.
Are the functions/classes/whatevers that are imported into the
namespace with >>> import module
but not otherwise referenced, explicitly loaded into the python
"workspace" (excuse me, I'm an unrepentant APL programmer)
including the __doc__ strings etc etc or not?
And if so, do they remain in the .pyc image?
And after py2app?
In the case where module is quite large (think wx or twisted for eg)
I'm wondering what are the relative advantages/disadvantages of, for
example
>>> import twisted
>>> class MessageHandler(twisted.internet.protocol.DatagramProtocol):
compared with
>>> from twisted.internet.protocol import DatagramProtocol
Class MessageHandler(DatagramProtocol):
other than the obvious easy of reading
"twisted.internet.protocol.DatagramProtocol" in a large environment
with many imported modules, which is my situation.
Any advise gratedfully acknowledged,
David
_________________________________________________
experimental polymedia: www.avatar.com.au
Sonic Communications Research Group,
University of Canberra. www.canberra.edu.au/vc-forum/scrg
vip=Verbal Interactivity Project
More information about the Pythonmac-SIG
mailing list