<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Aug 26, 2015 at 9:40 PM, Mike Miller <span dir="ltr"><<a href="mailto:python-ideas@mgmiller.net" target="_blank">python-ideas@mgmiller.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">With the major design decisions made, behold version 2 of my draft PEP on string interpolation.<br>
<br>
It's now significantly shorter due to removal of most of the i18n related discussion, pruning, as well as simplification of the prose itself. I don't expect many changes from here on:<br>
<br>
<a href="https://bitbucket.org/mixmastamyk/docs/src/default/pep/pep-05XX.rst" rel="noreferrer" target="_blank">https://bitbucket.org/mixmastamyk/docs/src/default/pep/pep-05XX.rst</a><br></blockquote><div><br></div><div>I'm confused by this proposal. There are many paragraphs about motivation, philosophy, other languages, etc., but the proposal itself seems to be poorly specified. E.g. I couldn't figure out what code should be produced by:<br><br></div><div> a = e"Sliced {n} onions in {t1-t0:.3f} seconds."<br><br></div><div>Generalizing from the only example in the specification, this would become:<br><br></div><div> a = est("Sliced {n} onions in {t1-t0:.3f} seconds", n=n, t1-t0=t1-t0)<br><br></div><div>which is invalid syntax. Similarly, I don't see how e.g. the following could be rendered correctly:<br><br></div><div> a = e"Three random numbers: {rand()}, {rand()}, {rand()}."<br></div><div><br></div><div>I also don't understand the claim that no str(estr) is necessary to render the result -- the estr implementation given at <a href="https://bitbucket.org/mixmastamyk/docs/src/default/pep/estring_demo.py">https://bitbucket.org/mixmastamyk/docs/src/default/pep/estring_demo.py</a> has a __str__ method that renders the .rendered attribute, but without the str() call the type of 'a' in the above examples would not be str, and various things that operate on strings (e.g. regular expression searches) would not work. A solution might be to make estr a subclass of str, but nothing in the PEP suggests that you have even considered this problem. (The only hint I can find is the comment "more magic-methods to be implemented here, to improve str compatibility" in your demo implementation, but without subclassing str this is not enough.)<br></div><div> </div></div>-- <br><div class="gmail_signature">--Guido van Rossum (<a href="http://python.org/~guido" target="_blank">python.org/~guido</a>)</div>
</div></div>