[Edu-sig] re: Types and true division (was Re: strange output)

Arthur ajs@ix.netcom.com
Fri, 11 Oct 2002 20:34:50 -0400


>But I have the ability to foresee where Bruce's and Michael's students are
>most likely to get caught with *their* pants down, under the new operator.
>Which are ways even more subtle, IMO, but just as likely to arise as with
my
>raised to a power issue.  So, on the gotcha score - at best a wash, IMO.

Kirby writes -

>(You don't spell out the gotchas with the new behavior -- examples
>might have been nice.)

Gotchas with the new behavior are not directly gotchas with the new
behavior.  They are gotchas that arise when being blindsided by the fact
that numeric typing matters.  Something clear to anyone functioning under
the old system.

The one I raised to Michael was:

>>> fromNumeric import *
>>> a=array([1,2,3])
>>> a[1]=.5
>>> a
array([1, 0, 3])

Huh? under new "/"
ouch - I should have seen that coming under old "/"

Michael acknowledged that that exact situation had already arisen and thrown
folks for a loop in his class.

Which is what was so bizarre to me about the discussion.  That 1/2 = 0 would
be an intial surprise to Bruce's students is so obviously true that it isn't
worth mentioning.  We could have all agreed as a starting point - relying on
nothing but our common sense - that we got an issue on our hands.

What might have been productive and interesting and actually a little
scientific, is to test the full reprecussions of the*change* to 1/2 = .5 for
Bruce's students.  And then *begin* a discussion of pros and cons.

And *I'm* the English major.

Art