Perl is worse!

David Bolen db3l at fitlinxx.com
Fri Jul 28 15:05:49 EDT 2000


grey at despair.rpglink.com (Steve Lamb) writes:

>     Yes it could, that is why good programmers check their input data before
> performing opertions when the data set is not trusted.

I'm curious, since you've raised this point a few times now.  If this
is true, then where is the pain, during this input check, of simply
making whatever conversion you need into an object type that you want
to use within the program.  If you then need it in another context,
you know what it is canonically within the program (since you input
checked/converted it) and can always request a conversion to the new
type at the point of need.

It seems to me that it isn't so much that Python doesn't let the
object get used as different types, but only that it doesn't try to
guess at the conversion necessary.  And when do you request a
conversion (say with str() to get a string), it's polymorphic - any
object can produce a string representation of itself, providing it
offers the __str__ function.

I suppose one of the cruxes of an issue here is whether or not the
more explicit conversion mechanism (note it isn't any less generic,
just less automatic) is beneficial or not.  I believe it is, even if
not for the initial development, then for the maintenance of the
program.

--
-- David
-- 
/-----------------------------------------------------------------------\
 \               David Bolen            \   E-mail: db3l at fitlinxx.com  /
  |             FitLinxx, Inc.            \  Phone: (203) 708-5192    |
 /  860 Canal Street, Stamford, CT  06902   \  Fax: (203) 316-5150     \
\-----------------------------------------------------------------------/



More information about the Python-list mailing list