[Twisted-Python] python's "import" is giving me a headache.

Itamar Shtull-Trauring twisted at itamarst.org
Wed Dec 5 04:52:47 EST 2001


Glyph Lefkowitz wrote:

>
>The end user would probably then have to do this in order to use that
>module:
>
>import twisted.words.service
>from twisted import words
>words.Service(...)
>

A bit more thought - this is a bad idea. It's certianly not a Very Bad 
Idea, but I really hope we comw up with something better. Consider - 
currently we have a a large number of namespaces, divided by the 
different things they do, and we can do stuff like having a schedule() 
method in twisted.internet.task. But with this suggestion we end up 
having only 7 or so namespaces, each of which has tens of methods, all 
of which do tons of different unrelated things (so there's 
twisted.internet.addDelayed, but also twisted.internet.StupidProxy - 
what's one got to do with the other? And how are they related to 
twisted.internet.schedule? why do I have to start reading through all 
these modules to figure out where they came from?)

At some point this will get too overwhelming (it may be too overwhelming 
now) and then we'll end up using subpackages, at which point we're back 
to where we started :)

The whole *point* of modules is to have just that - differenet 
namespaces that are to some degree self contained and can be understood 
more or less on their own, while this proposal is a push away from that 
(not a very large one, but still.)






More information about the Twisted-Python mailing list