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