Chetan Pandya wrote:
> My statement wasn't clear enough.
>
> Rendering occurs if the string being concatenated is already a
> concatenation object created by an earlier assignment.
>
I'm not sure how you came to that conclusion. My reading of the patch
doesn't suggest that at all. The operation of string_concat would not
produce what you suggest. I can't find anything anywhere that would
cause the behavior you suggest. The only case where this is true is if
the depth of the tree is too great.
To revisit your example, I will notate concats as string pairs:
a = "Value a =" # new string
a += "anything" # ("Value a =", "anything")
c = a + b # (("Value a =", "anything"), b)
c += "Something" # ((("Value a =", "anything"), b), "Something"
So again, for your other example of repeated right-hand concatenation,
you do not continually render the concat object, you merely create new
one and attach to the leaves. Once the print is executed, you will force
the rendering of the object, but only once that happens.
So in contrast to your statement, there are actually there are fewer
allocations of strings and smaller objects being allocated than the
current trunk uses.
--
Scott Dial
[EMAIL PROTECTED]
[EMAIL PROTECTED]
--
Scott Dial
[EMAIL PROTECTED]
[EMAIL PROTECTED]
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com