On Tue, Jun 25, 2013 at 11:35 AM, Peter Otten <__pete...@web.de> wrote:
> eryksun wrote:
>
>> Constant folding for binary operations has a length limit of 20 for
>> sequences:
>>
>> >>> dis.dis(lambda: '0123456789' + '0123456789' + '0')
>> 1 0 LOAD_CONST 3 ('012345
eryksun wrote:
> Constant folding for binary operations has a length limit of 20 for
> sequences:
>
> >>> dis.dis(lambda: '0123456789' + '0123456789' + '0')
> 1 0 LOAD_CONST 3 ('0123456789
> 0123456789')
>
On Tue, Jun 25, 2013 at 10:11 AM, Peter Otten <__pete...@web.de> wrote:
>
> In older Pythons for ("alpha" "beta") the compiler would merge the two
> strings into one whereas ("alpha" + "beta") would trigger a str.__add__()
> call at runtime. Nowadays the peephole optimiser recognizes ("alpha" +
> "
Albert-Jan Roskam wrote:
> ___
>>From: eryksun
>>To: Jim Mooney
>>Cc: tutor@python.org
>>Sent: Tuesday, June 25, 2013 2:14 PM
>>Subject: Re: [Tutor] mistaken about splitting expressions over lines
>
>
>
>>
>>
___
>From: eryksun
>To: Jim Mooney
>Cc: tutor@python.org
>Sent: Tuesday, June 25, 2013 2:14 PM
>Subject: Re: [Tutor] mistaken about splitting expressions over lines
>
> >>> a = ('this' # this way
> ...
On Mon, Jun 24, 2013 at 9:58 PM, Dave Angel wrote:
>
> Alternatively, you can also use the statement continuation mechanism,
> whereby the last character of the line is a backslash. Using that approach
> you can break almost anywhere, except within a token or inside a string
> literal.
Also, the
On 06/24/2013 09:48 PM, Jim Mooney wrote:
For some reason I took the impression that you could split expressions
over lines. However, this works:
word = 'spam'
new_word = word + 'eggs'
print(word)
But this is a syntax error:
word = 'spam'
new_word = word +
'eggs'
print(word)
That's easy to
For some reason I took the impression that you could split expressions
over lines. However, this works:
word = 'spam'
new_word = word + 'eggs'
print(word)
But this is a syntax error:
word = 'spam'
new_word = word +
'eggs'
print(word)
That's easy to avoid, but what if you're adding five or six