Pardon my ignorance, data conversion

Ivan Van Laningham ivanlan at callware.com
Tue Jan 18 21:22:01 EST 2000


Hi All--

"Michael P. Reilly" wrote:
> 

[bobbitt]

> Floor does funny things to negative numbers.
> 

I disagree.  They're not funny, only unexpected if you've been working
with C or some other language that doesn't floor() or ceil() the same
way Python does.  It's merely a different perspective on what's right.

If you rely on the C-like behaviour, then you can devise your own
function that checks the sign of the operands, does an abs(), does the
floor() or ceil() on the positive numbers, and returns the negative of
that result when appropriate.

Personally, I've only found one and only one instance where I required
the C-like behaviour.

<an-n-of-one-is-not-a-groundswell>-ly y'rs,
Ivan
----------------------------------------------
Ivan Van Laningham
Callware Technologies, Inc.
ivanlan at callware.com
ivanlan at home.com
http://www.pauahtun.org
See also: 
http://www.foretec.com/python/workshops/1998-11/proceedings.html
Army Signal Corps:  Cu Chi, Class of '70
Author:  Teach Yourself Python in 24 Hours
----------------------------------------------




More information about the Python-list mailing list