A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-July/067857.html below:

[Python-Dev] Rounding float to int directly (Re: struct module and coercing floats to integers)

[Python-Dev] Rounding float to int directly (Re: struct module and coercing floats to integers) [Python-Dev] Rounding float to int directly (Re: struct module and coercing floats to integers)Raymond Hettinger rhettinger at ewtllc.com
Mon Jul 31 20:34:26 CEST 2006
Greg Ewing wrote:

>As an aside, does anyone else think that it would be
>useful to have a builtin which rounds and converts to
>an int in one go? Whenever I use round(), I almost
>always want the result as an int, and making me do
>it in two steps seems unnecessarily bothersome.
>  
>
I think this would harm more than it would help.  It more confusing to 
have several rounding-thingies to choose from than it is have an 
explicit two-step.


BTW,  I thought the traditional idiom (for positive numbers) was:  int(x+.5)


>Since automatic float->int coercion is being increasingly
>disallowed, use cases for this are becoming more and more
>common.
>
>--
>Greg
>_______________________________________________
>Python-Dev mailing list
>Python-Dev at python.org
>http://mail.python.org/mailman/listinfo/python-dev
>Unsubscribe: http://mail.python.org/mailman/options/python-dev/rhettinger%40ewtllc.com
>  
>

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4