Integer division

Sion Arrowsmith siona at chiark.greenend.org.uk
Thu Jun 7 13:18:26 CEST 2007


jm.suresh at no.spam.gmail.com <jm.suresh at gmail.com> 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 chiark.greenend.org.uk -- http://www.chaos.org.uk/~sion/
   "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