Mark Dickinson added the comment: Nitin:
> Is there any operator for integer division in python? Yes, there is: the '//' operator. :-) There's no universally agreed upon definition for 'integer division' when negative numbers enter the mix, but I'm guessing that in this case you need something that rounds towards 0 instead of towards -infinity. There's no dedicated operator for that, but you can simply do (assuming that b is positive): -(-a // b) if a < 0 else a // b References: [1] http://python-history.blogspot.co.uk/2010/08/why-pythons-integer-division-floors.html [2] http://docs.python.org/2/faq/programming.html#why-does-22-10-return-3 ---------- nosy: +mark.dickinson _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue19446> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com