splitting a long token across lines

Josiah Carlson jcarlson at uci.edu
Sun Apr 4 14:45:11 EDT 2004


> MODULUS = 7567567567567567567567567567567\
>           7567507546546986094860986094860\
>           2345646986598695869548498698989\
>           ...

Seems that you cannot use line continuation for integers.  Unfortunate.

However, using strings to store the value, then later converting it 
doesn't incur a significant overhead, as long as you are only 
initializing MODULUS once.

MODULUS = '7567567567567567567567567567567'\
           '7567507546546986094860986094860'\
           '2345646986598695869548498698989'\
           ...

MODULUS = int(MODULUS)

  - Josiah



More information about the Python-list mailing list