UCALC equivalent
Cameron Laird
claird at lairds.us
Fri Aug 12 20:08:04 EDT 2005
In article <Xns96B0C211F72E8maxericksongmailcom at 216.168.3.44>,
Max Erickson <maxerickson at gmail.com> wrote:
.
.
.
>> The python equivalent:
>>
>> exec "def area(length,width): return length*width"
>> exec "def frac(x): return abs(abs(x) - int(abs(x)))"
>> exec "def test(): return 5"
>> exec "def abc(x, y=10): return x + y"
>> exec "def shl(x, y): return x * 2^y"
>>
>> print eval("frac(150/17) * area(20,30)")
>> print eval("abc(5) - abc(3,4) * shl(0x0E, 1)")
>>
>> --Scott David Daniels
>> Scott.Daniels at Acm.Org
>>
>
>Ouch, I sure was wrong. You did such a good job making me look
>foolish that it was mentioned in Python-URL!. At least Larry Bates
>had the grace not to call me an idiot.
>
>max
"Python-URL!" makes a point of highlighting positive achievements.
We all create enough foolishness to obviate any need to pass *that*
on.
More information about the Python-list
mailing list