In article 
<[EMAIL PROTECTED]>,
 "Paul Moore" <[EMAIL PROTECTED]> wrote:

> On 24/01/2008, Jeffrey Yasskin <[EMAIL PROTECTED]> wrote:
> > int has to be a builtin because it's a fundamental type. trunc()
> > followed round() into the builtins. I have no opinion on whether ceil
> > and floor should move there; it probably depends on how often they're
> > used.
> 
> Suggestion:
> 
> - int() has to stay in builtins for obvious reasons.
> - put *all* of trunc, ceil, floor, round into math.
> - make int(float) an error

I like all of your suggestions except the last one. Remember the problem 
with a/b depending on whether b happened to be a float or an int? I 
think you'll be creating a very similar problem here. In my opinion 
int(foo) should do its best to turn foo into an int with *predictable* 
behavior.

The least surprising behavior for int(float) is probably trunc(float). 
Personally I prefer round(float), but I doubt it is worth breaking code 
and retraining everybody.

-- Russell

_______________________________________________
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

Reply via email to