> cnt = 1
> def foo():
> global cnt
> cnt += 1
> return cnt
>
> def bar(x=foo()):
> print x
>
> bar() # 2
> bar() # 2
> bar() # 2
Looks to me like you want to use the following programming pattern to
get dynamic default arguments:
cnt = 1
def foo():
global cnt
> Nope. That only *nearly* does what T wants. The usage message will
> still be printed immediately *after* the 'usage: ' string.
>
> >>> parser = OptionParser(usage=usage)
> >>> parser.print_help()
> usage: THIS IS NEWLY INSERTED STRING
> usage: lopts.py [options] input
> No, that affects the string printed only *after* the "usage = " string.
> What I would like to do is insert some string *before* the "usage = "
> string, which is right after the command I type at the command prompt.
> So I would like to make it look like this:
The example was fine (except for
Measure it and find out. Sounds like a little investment in your time
learning how to measure performance may pay dividends for you.
--
http://mail.python.org/mailman/listinfo/python-list
Carl -- Perfect! That is exactly what I want. I hoped it would be
that easy. Thanks for taking the time to post the solution.
--
http://mail.python.org/mailman/listinfo/python-list
Is there a way to temporarily halt execution of a script (without using
a debugger) and have it put you in an interactive session where you
have access to the locals? And possibly resume? For example:
>>> def a():
... x = 1
... magic_breakpoint()
... y = 1
... print "got here"
...
>>> a(
This looks like it has nothing to do with Pmw (Mega widgets) but is
really a basic Tkinter problem.
--
http://mail.python.org/mailman/listinfo/python-list
Thanks in advance,
Dan Gass
--
http://mail.python.org/mailman/listinfo/python-list
enabled by default.
+ May be extended to support syntax such as XML.
Enjoy,
Dan Gass
--
http://mail.python.org/mailman/listinfo/python-list
rsion, but the area that you would be
looking at is not changing so I would go ahead and download the latest
that is there. TestGen can be found at
sourceforge.net/projects/testgen
Regards,
Dan Gass
--
http://mail.python.org/mailman/listinfo/python-list
reciated. I've spent a fair
amount of time implementing and testing features that I don't really
use in order to be able to contribute this to the Python community. If
you would like to see it (or see specific features it has) in the
standard library I encourage you to make comments at
http://www.python.org/moin/ConfigParserShootout
Regards,
Dan Gass
--
http://mail.python.org/mailman/listinfo/python-list
Enjoy,
Dan Gass
--
http://mail.python.org/mailman/listinfo/python-list
TestGen 0.05 is now available and contains significant enhancements.
What's New
--
Significant Enhancements/Changes
1) added manipc.py, a generic C/C++ source manipulator that can be used for
function/method isolation and stubbing for the purposes of unit testing
with any test frame
13 matches
Mail list logo