A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/attachments/20150905/ecb16a78/attachment.html below:

<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sat, Sep 5, 2015 at 1:44 AM, haypo s <span dir="ltr"><<a href="mailto:victor.stinner@gmail.com" target="_blank">victor.stinner@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">2015-09-05 5:01 GMT+02:00 Guido van Rossum <<a href="mailto:guido@python.org">guido@python.org</a>>:<br>
> And I'm ready to accept it. I'll wait until Tuesday night (Monday's a<br>
> holiday in the US) in case anything unforeseen comes up, but this is really<br>
> the Last Call for this PEP.<br>
<br>
</span>String concatenation is inefficient in Python because strings are<br>
immutable. There is a micro-optimization which tried to reduce the bad<br>
performances of a+b, but it's better to avoid it.<br>
<br>
Python replaces >'abc' 'def'< with a single string >'abcdef'<. It's<br>
done by the parser, there is no overhead at runtime.<br>
<br>
PEP 498 allows to write >'abc' f'string'< which is replaced with<br>
>'abc' 'string'.__format__()< whereas str+str is a bad practice.<br>
<br>
I would prefer to force users to write an explicit '+' to remind them<br>
that there are more efficient ways to concatenate strings like<br>
''.join((str1, str2)) or putting the first string in the f-string:<br>
>f'abcstring'<.<br>
<br>
Section in the PEP:<br>
<a href="https://www.python.org/dev/pepsstring/pep-0498/#concatenating-strings" rel="noreferrer" target="_blank">https://www.python.org/dev/pepsstring/pep-0498/#concatenating-strings</a><br>
<br>
Victor<br>
</blockquote></div><br></div><div class="gmail_extra">What does the extra + buy users? It's just more punctuation noise.  The implementation is intentionally left unspecified by the PEP; it should be possible to design an implementation that  combines all the parts together more efficiently than the use of + (e.g. using a "string builder" object internally).<br clear="all"></div><div class="gmail_extra"><br>-- <br><div class="gmail_signature">--Guido van Rossum (<a href="http://python.org/~guido" target="_blank">python.org/~guido</a>)</div>
</div></div>

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4