line continuations with backslash

Paul Rubin phr-n2001 at nightsong.com
Mon Aug 27 08:30:50 EDT 2001


"Tim Peters" <tim.one at home.com> writes:
> > so why not this then:
> >
> >     x = long("123"
> >              "456"
> >              "789")
> >
> > which saves all the splitting and joining and is (nearly) as readable?
> 
> Because it's not as readable, or as easy to edit.  The cost of splitting and
> joining on one-shot initialization code is insignificant, most likely too
> small to measure.

The cpu costs of splitting and joining at initialization are
insignificant but writing out the numbers in ascii instead of in
marshalled form makes the .pyc files somewhat bigger (a few hundred
bytes in this situation).  That shouldn't be disastrous but it strikes
me as unnecessary bloat.  Being able to split literals with backslash
wouldn't mess up the language in any way I can easily see.

Btw, the target computer is a handheld with limited memory and whose
file system is entirely in ram, so burning space unnecessarily in the
.pyc hurts a little more than it would on a pc with gigabytes of disk
available.



More information about the Python-list mailing list