[Edu-sig] reviewing the context manager construct

kirby urner kirby.urner at gmail.com
Fri Mar 28 15:39:41 CET 2014


On Fri, Mar 28, 2014 at 6:04 AM, Vernon D. Cole <vernondcole at gmail.com>wrote:

> You are working too hard in creating your string literal.
>
> The *Python Language Reference Manual*  says:
>
>> 2.4.2. String literal concatenation Multiple adjacent string literals
>> (delimited by whitespace), possibly using different quoting conventions,
>> are allowed, and their meaning is the same as their concatenation. Thus,
>> "hello" 'world' is equivalent to "helloworld". This feature can be used
>> to reduce the number of backslashes needed, to split long strings
>> conveniently across long lines, [...]
>>
>
>
Right, so no need for all those backslashes:


digits = ("1."
"61803398874989484820458683436563811772030917980576286213544862270526046281890"
"244970720720418939113748475408807538689175212663386222353693179318006076672635"
"443338908659593958290563832266131992829026788067520876689250171169620703222104"
"321626954862629631361443814975870122034080588795445474924618569536486444924104"
"432077134494704956584678850987433944221254487706647809158846074998871240076521"
"705751797883416625624940758906970400028121042762177111777805315317141011704666"
"599146697987317613560067087480710131795236894275219484353056783002287856997829"
"778347845878228911097625003026961561700250464338243776486102838312683303724292")



> Also, the output is hard to really comprehend.  So, may I humbly submit...
>
>
Thanks.

Kirby
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/edu-sig/attachments/20140328/11748cd5/attachment.html>


More information about the Edu-sig mailing list