[Numpy-discussion] ?

Steve Holden sholden at holdenweb.com
Thu Oct 26 21:32:16 EDT 2000


Does this all mean that the traditionalists among us are going to
need a "divnanny.py" program to avoid code breakage?

I can understand and* appreciate all the arguments suggesting that
division of two integers should yield a non-integer result.  Maybe
I've just been programming too long, so I have fixed ideas about
how the integers should behave in programming, which is NOT the way
they behave in mathematics.

It's been correctly pointed out that the languages which retain
integer results for all integer operations do so because that's the
way underlying hardware has operated since time immemorial.

It may not be a good thing to have high-level language behavior
dictated by hardware concerns, but sadly there are many many programs
out there which rely on current integer arithmetic semantics, and I
for one wouldn't feel like breaking them in such a radical way.

regards
 Steve

* (to an extent)


Mark Jackson wrote:
> 
> Konrad Hinsen <hinsen at cnrs-orleans.fr> writes:
> > boncelet at udel.edu@SMTP at python.org writes:
> 
> > > But (donning my contrarian hat), while appealing to newcomers
> > > is a laudable goal, Python will die if it does not appeal to serious
> > > programmers writing serious code.  The CS world is littered with
> > > dead teaching languages (anyone remember PLC?).  IMHO, the
> > > right question to ask is "what do serious programmers want?"
> >
> > Making the bold claim to be a serious programmer, I'd say they want to
> > be able to specify either integer or float division, but they don't
> > care about the precise syntax, as long as both are straightforward to
> > do.
> 
> Absolutely.  I come from a Fortran background and have no trouble at
> all with 3/2 yielding 1.  The problem is that code seldom looks like
> this:
> 
>         a = 3/2
> 
> Instead it looks like this:
> 
>         a = b/c
> 
> and I have yet to find an algorithm for which "b/c yields integer if b
> and c are both integers, else float" is actually appropriate behavior!
> Particularly in my usual application domain (Python as an interactive
> steering and scripting language for Fortran and C modules) preventing
> inadvertent arrival of integers at such expressions is a major PITA.
> Give us div, or (better) //, for integer division.  The purists can
> then overload it for their class-of-rationals.
> 
> --
> Mark Jackson - http://www.alumni.caltech.edu/~mjackson
>         I respect faith, but doubt is what gets you an education.
>                                 - Wilson Mizner

-- 
Helping people meet their information needs with training and technology.
703 967 0887      sholden at bellatlantic.net      http://www.holdenweb.com/





More information about the Python-list mailing list