newbie: generate a function based on an expression

2005-12-12 Thread Ezequiel, Justin
 def genFun(expr, locs):
... return lambda x: eval('min(Max,max(Min,%s))' % expr, locs, {'x':
x})
... 
 fun = genFun(A*x+off, {'A': 3.0, 'off': -0.5, 'Max': 2.0,  'Min':
-2.0} )
 fun
function lambda at 0x011B1470
 fun(0)
-0.5
 fun(-10)
-2.0
 fun(10)
2.0
 
-- 
http://mail.python.org/mailman/listinfo/python-list


pyparsing and LaTeX?

2005-12-09 Thread Ezequiel, Justin
 Anyone parsing simple LaTeX constructs with pyparsing?

Greetings Tim,

Have always wanted a way to parse LaTeX myself.
Unfortunately, I have been moved to a different project.
However, I am still very much interested.
Did you ever get a reply?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: what's wrong with lambda x : print x/60,x%60

2005-12-04 Thread Ezequiel, Justin
Try 

lambda_hrs = lambda x: (x/60,x%60)
-- 
http://mail.python.org/mailman/listinfo/python-list


get current function name

2005-12-01 Thread Ezequiel, Justin
See module inspect
-- 
http://mail.python.org/mailman/listinfo/python-list