UCALC equivalent
Scott David Daniels
Scott.Daniels at Acm.Org
Fri Aug 12 20:06:50 EDT 2005
Max Erickson wrote:
> Scott David Daniels <Scott.Daniels at Acm.Org> wrote in
> news:42fcea4a$1 at nntp0.pdx.net:
>
>
>>max wrote:
>> From the web page referenced:
>> ...
>> cout << ucEval("abc(5)-abc(3,4)*(#b01101 shl 1)")
>> << endl;
>>The python equivalent:
>> ...
>> print eval("abc(5) - abc(3,4) * shl(0x0E, 1)")
>
> Ouch, I sure was wrong. You did such a good job making me look
> foolish that it was mentioned in Python-URL!.
Sorry, I wasn't trying to make you look foolish. I was trying to
nip a misconception in the bud.
I also forgot how to convert binary to an integer (the #b01101 above)
when I was writing it, so that last line should read:
print eval("abc(5) - abc(3,4) * shl(int('01101', 2), 1)")
--Scott David Daniels
Scott.Daniels at Acm.Org
More information about the Python-list
mailing list