Python 3 rounding behavior in Python 2
Question: In Python 2.x, the built-in
[`round`](http://docs.python.org/2/library/functions.html#round) has the
following behavior:

> if two multiples are equally close, rounding is done **away from 0** (so.
> for example, round(0.5) is 1.0 and round(-0.5) is -1.0)

In Python 3.x, [this has
changed](http://docs.python.org/3/library/functions.html#round) to the more
common:

> if two multiples are equally close, rounding is done **toward the even
> choice** (so, for example, both round(0.5) and round(-0.5) are 0, and
> round(1.5) is 2).

Is there an easy way to get this behavior in Python 2.x? Unfortunately, the
[`future_builtins`](http://docs.python.org/2/library/future_builtins.html)
module doesn't include this. Maybe there's another similar module I haven't
found yet? Or, another way to pull Python 3.x functions into Python 2.x?

Obviously, I could write a new function that produces the desired behavior,
but I'm more curious if a solution exists that uses the actual Python 3.x
function, to avoid adding unnecessary complexity and code to maintain.


Answer: Unless you mind a numpy dependency,
[`numpy.around`](http://docs.scipy.org/doc/numpy/reference/generated/numpy.around.html)
may do the thing:

    
    
    >>> from numpy import around
    >>> around(0.5)
    0
    >>> around(-0.5)
    -0
    >>> around(1.5)
    2.0
    

