"Sion Arrowsmith" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
| [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
| > 3/2 => 1 # Usual behavior
| > some_func(3, 2) => 2 # Wanted
|
| def some_func(a, b):
|    return -(-a/b)
|
| And people complain about Python's behaviour regarding division of
| negative integers.

Nice.  This goes on my 'why didn't I think of that' list;-)

I was thinking of the rather pedestrian

d,r = divmod(a,b)
if r: d+=1

tjr



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to