PEP0238 lament
Stephen Horne
steve at lurking.demon.co.uk
Mon Jul 23 16:47:46 EDT 2001
On Mon, 23 Jul 2001 17:11:10 GMT, Ben Wolfson
<rumjuggler at cryptarchy.org> wrote:
>On Mon, 23 Jul 2001 12:21:58 +0100, Steve Horne <sh at ttsoftware.co.uk>
>wrote:
>
>>Integers are much more used in scripting code than floats - subscripts
>>and loop indices being the main culprits. Integer division happens
>>quite a bit. All that code is just going to suddenly stop working. How
>>nice.
>
>If integer division is more common than float division, why not let '/'
>retain its current meaning and use '//' for "yes, I want a float result"?
>int / int -> int
>float / int, int / float, float / float -> whatever these currently mean
>with "//" in Guido's patch
>int // int -> float, rational, or whatever
Suggested many times by many people - but no real answer yet. The only
counter with any noticable backing was that the language should be
dumbed down to the point where newbies and students never actually
learn anything - not quite worded like that, of course ;-)
The only application where a genuine need for some kind of change has
been shown is in numerics - the fear of dramatically wrong results
through the accidental use of integers. In that case the programmers
should be quite used to looking for potential accuracy and precision
problems since apparent identities don't hold exactly with float
approximations, and a small error in an intermediate result can cause
huge errors in final results whether division is used or not. They
should therefore be *expected* to have some knowledge and
understanding - that is their job - and they should be quite capable
of dealing with an alternate operator or some mechanism to explicitly
request coercion or whatever.
More information about the Python-list
mailing list