Re: Splitting numeric litterals

2010-07-16 Thread Steven D'Aprano
On Fri, 16 Jul 2010 15:41:45 +0100, MRAB wrote: >> It always makes me laugh when I receive an invoice from some company, >> and the account number or invoice number is (e.g.) 100023456789. >> Who do they think they're fooling? >> > It's possible that they're splitting it into fields. Anythin

Re: Splitting numeric litterals

2010-07-16 Thread Steven D'Aprano
On Fri, 16 Jul 2010 18:30:38 +0100, bart.c wrote: >> It always makes me laugh when I receive an invoice from some company, >> and the account number or invoice number is (e.g.) 100023456789. >> Who do they think they're fooling? > > I used to do that. Giving someone an invoice number, or prod

Re: Splitting numeric litterals

2010-07-16 Thread Terry Reedy
On 7/16/10 12:30 PM, bart.c wrote: they have to be exact. So if you wanted to hardcode 1000! for some reason, you'd need some 2568 digits which is a little awkward on one line. No, only 20 digits >>> math.factorial(1000) 402387260077093773543702433923003985719374 ... Most big ints people w

Re: Splitting numeric litterals

2010-07-16 Thread Robert Kern
On 7/16/10 12:30 PM, bart.c wrote: "Steven D'Aprano" wrote in message news:4c4069de$0$11101$c3e8...@news.astraweb.com... On Fri, 16 Jul 2010 14:49:21 +0100, MRAB wrote: Not only that, but it only takes 73 digits to write out the total number of particles in the entire universe: 100

Re: Splitting numeric litterals

2010-07-16 Thread bart.c
"Steven D'Aprano" wrote in message news:4c4069de$0$11101$c3e8...@news.astraweb.com... On Fri, 16 Jul 2010 14:49:21 +0100, MRAB wrote: Not only that, but it only takes 73 digits to write out the total number of particles in the entire universe: 10

Re: Splitting numeric litterals

2010-07-16 Thread MRAB
Steven D'Aprano wrote: On Fri, 16 Jul 2010 14:49:21 +0100, MRAB wrote: Lawrence D'Oliveiro wrote: In message , MRAB wrote: Normally it's only string literals that could be so long that you might want to split them over several lines. It is somewhat unusual to have a _numeric_ literal that's

Re: Splitting numeric litterals

2010-07-16 Thread Steven D'Aprano
On Fri, 16 Jul 2010 14:49:21 +0100, MRAB wrote: > Lawrence D'Oliveiro wrote: >> In message , MRAB >> wrote: >> >>> Normally it's only string literals that could be so long that you >>> might want to split them over several lines. It is somewhat unusual to >>> have a _numeric_ literal that's very

Re: Splitting numeric litterals

2010-07-16 Thread MRAB
Lawrence D'Oliveiro wrote: In message , MRAB wrote: Normally it's only string literals that could be so long that you might want to split them over several lines. It is somewhat unusual to have a _numeric_ literal that's very very long! Seems a peculiar assumption to make in a language that a

Re: Splitting numeric litterals

2010-07-15 Thread Lawrence D'Oliveiro
In message , MRAB wrote: > Normally it's only string literals that could be so long that you might > want to split them over several lines. It is somewhat unusual to have a > _numeric_ literal that's very very long! Seems a peculiar assumption to make in a language that allows integers of arbitr

Re: Splitting numeric litterals

2010-07-14 Thread candide
MRAB a écrit : want to split them over several lines. It is somewhat unusual to have a _numeric_ literal that's very very long! I agree. But consider RSA-155 for instance ... ;) For an integer literal you could use a string literal and convert it to an integer: >>> int("1000\ 000\ 000")

Re: Splitting numeric litterals

2010-07-14 Thread MRAB
candide wrote: The escape sequence \ENTER allows to split a string over 2 consecutive lines. On the other hand, it seems impossible to split a numeric litteral across multiple lines, compare : >>> "1000\ ... 000\ ... 000" '10' >>> 1000\ ... 000\ File "", line 2 000\ ^ Syn

Re: Splitting numeric litterals

2010-07-14 Thread Steven D'Aprano
On Thu, 15 Jul 2010 03:30:24 +0200, candide wrote: > The escape sequence \ENTER allows to split a string over 2 consecutive > lines. On the other hand, it seems impossible to split a numeric > litteral across multiple lines [...] > Is this the general behaviour ? Yes. You can't put any whitespac