In article <79990c6b0801250553l2e6247adudf48112436dcda70@mail.gmail.com>, "Paul Moore" <p.f.moore@gmail.com> wrote:
On 24/01/2008, Jeffrey Yasskin <jyasskin@gmail.com> 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