A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-May/024826.html below:

[Python-Dev] Re: Python-Dev digest, Vol 1 #2276

[Python-Dev] Re: Python-Dev digest, Vol 1 #2276 - 14 msgsKevin Butler kbutler@campuspipeline.com
Fri, 31 May 2002 14:35:04 -0600
I asked about publishing a module & submodules in one .py file, and showed an 
implementation.

Guido responded:
 > I think it's much better to split it up in multiple files than to use
 > all those hacks.  Those hacks are hard to understand for someone
 > trying to read the code.

I agree - I don't like the look of that code for user-level code. However, to 
me the complexity was that I had to show the implementation (and the dynamic 
"getMethods" call instead of explicitly listing methods to publish).

If the 'imp' module had a 'publish_module' method that created a module (with 
an optional dictionary?) & registered it in sys.modules, client code becomes 
very simple, clear, and can be very explicit:

assertions = imp.publish_module( __name__ + ".assertions" )
_a = Assertions()
assertions.failUnless = _a.failUnless
# ...

Is that more pleasant, or is the whole idea of organizing portions of a single 
file into submodules unacceptable?

kb





RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4