Re: A funnily inconsistent behavior of int and float

2008-04-07 Thread Terry Reedy
"Mark Dickinson" <[EMAIL PROTECTED]> wrote in message | Excellent! | It looks to me as though this covers everything. I'm tempted to | quibble about exact wordings, but probably the most productive thing to do | would be just to submit this to bugs.python.org and then let Georg Brandl | work his

Re: A funnily inconsistent behavior of int and float

2008-04-07 Thread Mark Dickinson
On Apr 7, 4:59 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > "Mark Dickinson" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > Thank you for the corrections. Here is my revised proposal: > > int([number | string[, radix]) > ... Excellent! It looks to me as though this covers e

Re: A funnily inconsistent behavior of int and float

2008-04-07 Thread Colin J. Williams
Terry Reedy wrote: > "Mark Dickinson" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > | On Apr 7, 6:43 am, "Colin J. Williams" <[EMAIL PROTECTED]> wrote: > | > This is good but the documentation for > | > 3.0 is missing the syntax documentation > | > from 2.5 > | > | Is > | > | >

Re: A funnily inconsistent behavior of int and float

2008-04-07 Thread Lie
On Apr 8, 2:15 am, "Terry Reedy" <[EMAIL PROTECTED]> wrote: (snip) > 2. Replace text with: > Convert a number or string to an integer.  If no arguments are given, > return 0.  If a number is given, return number.__int__().  Conversion of > floating point numbers to integers truncates towards zero.

Re: A funnily inconsistent behavior of int and float

2008-04-07 Thread Terry Reedy
"Mark Dickinson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Thank you for the corrections. Here is my revised proposal: int([number | string[, radix]) Convert a number or string to an integer. If no arguments are given, return 0. If a number is given, return number.__int__().

Re: A funnily inconsistent behavior of int and float

2008-04-07 Thread Mark Dickinson
On Apr 7, 3:53 pm, Mark Dickinson <[EMAIL PROTECTED]> wrote: > The only base 0 versus base 10 difference I could find was the > following: > > >>> int('033', 0) > > Traceback (most recent call last): > File "", line 1, in > ValueError: invalid literal for int() with base 0: '033' > [38720 refs]>

Re: A funnily inconsistent behavior of int and float

2008-04-07 Thread Mark Dickinson
On Apr 7, 3:15 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > > My suggestions: > 1. Change signature to: int([number | string[, radix]). > This makes it clear that radix can only follow a string without having to > say so in the text. > > 2. Replace text with: > Convert a number or string to an in

Re: A funnily inconsistent behavior of int and float

2008-04-07 Thread Terry Reedy
"Mark Dickinson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | On Apr 7, 6:43 am, "Colin J. Williams" <[EMAIL PROTECTED]> wrote: | > This is good but the documentation for | > 3.0 is missing the syntax documentation | > from 2.5 | | Is | | http://docs.python.org/dev/3.0/reference

Re: A funnily inconsistent behavior of int and float

2008-04-07 Thread Mark Dickinson
On Apr 7, 6:43 am, "Colin J. Williams" <[EMAIL PROTECTED]> wrote: > This is good but the documentation for > 3.0 is missing the syntax documentation > from 2.5 Is http://docs.python.org/dev/3.0/reference/lexical_analysis.html#integer-literals the documentation that you're looking for? But it se

Re: A funnily inconsistent behavior of int and float

2008-04-07 Thread Colin J. Williams
Mark Dickinson wrote: > On Apr 6, 1:29 pm, Lie <[EMAIL PROTECTED]> wrote: >> I've noticed some oddly inconsistent behavior with int and float: >> >> Python 2.5.1 (r251:54863, Mar 7 2008, 03:39:23) >> [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2>>> >> int('- 345')

Re: A funnily inconsistent behavior of int and float

2008-04-06 Thread Mark Dickinson
On Apr 6, 1:29 pm, Lie <[EMAIL PROTECTED]> wrote: > I've noticed some oddly inconsistent behavior with int and float: > > Python 2.5.1 (r251:54863, Mar  7 2008, 03:39:23) > [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2>>> > int('-          345') > > -345 > > works, but > > >

Re: A funnily inconsistent behavior of int and float

2008-04-06 Thread Colin J. Williams
Grant Edwards wrote: > On 2008-04-06, Lie <[EMAIL PROTECTED]> wrote: > >> I've noticed some oddly inconsistent behavior with int and float: >> >> Python 2.5.1 (r251:54863, Mar 7 2008, 03:39:23) >> [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2 > int('- 345') >>

Re: A funnily inconsistent behavior of int and float

2008-04-06 Thread Grant Edwards
On 2008-04-06, Lie <[EMAIL PROTECTED]> wrote: > I've noticed some oddly inconsistent behavior with int and float: > > Python 2.5.1 (r251:54863, Mar 7 2008, 03:39:23) > [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2 int('- 345') > -345 > > works, IMO, it oughtn

A funnily inconsistent behavior of int and float

2008-04-06 Thread Lie
I've noticed some oddly inconsistent behavior with int and float: Python 2.5.1 (r251:54863, Mar 7 2008, 03:39:23) [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2 >>> int('- 345') -345 works, but >>> float('- 345.083') Traceback (most recent call last): File