def intdiv(a, b):
     return (a - (a % (-b if a < 0 else b))) / b



Duh ... Got confused with modulos (again).

def intdiv(a, b):
    return (a - (a % (-abs(b) if a < 0 else abs(b)))) / b

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

Reply via email to