splitting a long token across lines
djw
dwelch91 at comcast.net
Sun Apr 4 18:15:49 EDT 2004
Nakamura wrote:
> Hi all,
>
> Say, I have a very long integer constant , how can
> I split across lines ?
> I tried something like
> MODULUS = 7567567567567567567567567567567\
> 7567507546546986094860986094860\
> 2345646986598695869548498698989\
> ...
> but it doesn't compile.
> Is there another way to write a long numeric constant besides writing
> it as a string and then converting to long? I also wouldn't like to put
> it all on one very long line.
>
> Thanks!
Well, I _suppose_ you could do this:
MODULUS = "7567567567567567567567567567567"\
7567507546546986094860986094860"\
2345646986598695869548498698989"\
...
MODULUS = int(MODULUS)
I'm sure I'm going to have to take some flak for this, though. I
wouldn't do it. What's wrong with really long lines? Anything you do
that I can see is going to obscure your code.
-D
More information about the Python-list
mailing list