[Python-Dev] Parrot -- should life imitate satire?
Tim Peters
tim.one@home.com
Sun, 12 Aug 2001 00:23:42 -0400
[Simon Cozens
on Thursday, August 02, 2001 1:30 PM]
> ...
> Oh, and here's our divide, for comparison:
>
> PP(pp_divide)
> {
> dSP; dATARGET; tryAMAGICbin(div,opASSIGN);
> {
> dPOPPOPnnrl;
> NV value;
> if (right == 0.0)
> DIE(aTHX_ "Illegal division by zero");
> value = left / right;
> PUSHn( value );
> RETURN;
> }
> }
>
> See, this is why we need a new interpreter. :)
Yes, I've tried to read the Perl source before <snarl/wink>. What does "/"
mean here? You're using native C arithmetic, or is this a C++ overload?
Even simple arithmetic is long-winded in Python, because, for example, the
int operations check for overflow, while the float operations allow for
catching IEEE-754 exceptions (or SIGFPE in general) and translating them
into Python-level exceptions. We also go thru piles and piles of code
coercing among different numeric types. If you were to step thru the Python
line
x = 3.0 / 4
in a debugger, it's a race on Windows between your finger getting numb and
the OS crashing ...