[MATRIX-SIG] integer division -- what a concept!

Geoffrey M. Furnish furnish@xdiv.lanl.gov
Tue, 20 Jan 1998 16:11:26 GMT

David J. C. Beach writes:
 > def foo(x, y):  # x and y need to be floats
 >     x, y = float(x), float(y)
 >     # at this point, x and y are either floats, or an exception was
 > raised
 >     # now, go about your usual business with confidence that operations
 >     # involving x and y will return floats (principle of least surprise)

If I had done this, I wouldn't have had my original problem.  Perhaps
I will start doing this.

But I remain offended that it is possible to write algorithms in
Python which behave radically differently if they are called as

z = foo( 1, 2 )


z = foo( 1., 2. )

Geoffrey Furnish                    email: furnish@lanl.gov
LANL XTM Radiation Transport/POOMA  phone: 505-665-4529     fax: 505-665-5538

"Software complexity is an artifact of implementation."    -Dan Quinlan

MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org