>> Most typical uses of round() don't use the >> optional argument, true, but I still fail >> to see what returning an integer instead of >> a float would buy you. > > > It saves you a function call in the vast > majority of cases, where an int is what > you ultimately want. >
-1 on an extra built-in just to save the time for function call -- this is a false optimization, one that is unlikely to ever be the bottleneck in any real program's running time. If it isn't time you care about but just hate writing it, what's wrong with a simple helper function like: rndint=lambda x: int(round(x)) ? There are no shortage of possible function pairs that could be proposed (perhaps list(set(x)) or int(abs(x)) for example). Of course, it would be silly to make new builtins for them. IMHO, the case is weak for adding a new variant of round(). Also, -10 on changing the semantics of int() to round instead of truncate. The truncating version is found is so many other languages and book examples, that it would be a disaster for us to choose a different meaning. Raymond _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com