PEP0238 lament

Stephen Horne steve at lurking.demon.co.uk
Mon Jul 23 21:28:47 EDT 2001


On Mon, 23 Jul 2001 22:53:42 GMT, "Tim Hochberg"
<tim.hochberg at ieee.org> wrote:

>Which is not too horrible, but it is extra cruft. So let me turn your
>question around. Can you give an example where you want the type of division
>(float vs floor) to change depending on the type of input (int, float,
>complex)? I can't, although I suspect there must be some. I also suspect
>they're very rare.

I doubt that's common, but it misses the point.

Division has the same basic meaning whether you are using ints or
floats - the float version has simply been extended in line with the
data type. No-one bar programmers in a few relatively minor languages
is going to expect different division symbols for different data
types.

If you write functions that do not logically work for completely
general inputs, then you should validate and/or coerce those inputs as
appropriate - one of the first things a programmer should learn is
document limitations and validate inputs from unknown sources. If you
don't want to do that longhand, then asking for a language facility to
make it easier is the obvious way to go.

We're told that a major part of the reason for this change is to help
students and non-programmer newbies learn programming more easily -
but what are we helping them learn? The most obvious lessons I can
think of are...

1.  Don't worry about data types, they'll magically sort themselves
    out until you've dug yourself a nice *big* hole.
2.  Validation is for wimps.
3.  Don't bother thinking - that's what the computers for.

Have I missed any?




More information about the Python-list mailing list