A startup puzzle

Aahz aahz at pythoncraft.com
Tue Oct 7 22:51:08 EDT 2003


In article <vnoiqbjg3hhrc8 at corp.supernews.com>,
Edward K. Ream <edreamleo at charter.net> wrote:
>
>Still, I don't see a perfect alternative.  For sure I wouldn't like
>to put a g. in front of hundreds or thousands of function calls.  I
>suppose that this is the kind of thing one would be forced to do in
>slightly larger projects...Any other ideas?

Note that it is certainly reasonable to do this:

    def foo():
        dialog = g.dialog
        d1 = dialog()
        d2 = dialog()
        d3 = dialog()
        d4 = dialog()

OTOH, it's a Bad Idea to do this:

    def bar():
        dialog = g.dialog
        d = dialog()

There's plenty of wiggle room for judgement calls of elision while still
keeping the purity of the namespace.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"It is easier to optimize correct code than to correct optimized code."
--Bill Harlan




More information about the Python-list mailing list