Integer division

Sion Arrowsmith siona at
Thu Jun 7 13:18:26 CEST 2007

jm.suresh at <jm.suresh at> 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.

\S -- siona at --
   "Frankly I have no feelings towards penguins one way or the other"
        -- Arthur C. Clarke
   her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump

More information about the Python-list mailing list