<p dir="ltr"><br>
On 15 Jan 2014 08:00, "Greg Ewing" <<a href="mailto:greg.ewing@canterbury.ac.nz">greg.ewing@canterbury.ac.nz</a>> wrote:<br>
><br>
> Guido van Rossum wrote:<br>
>><br>
>> def spam(a):<br>
>>     r = asciistr('(')<br>
>>     if a: r += a.strip()<br>
>>     r += asciistr(')')<br>
>>     return r<br>
>><br>
>>  The general fix would be to add<br>
>><br>
>>     else: r += a[:0]<br>
><br>
><br>
> The awkwardness might be reducable if asciistr let<br>
> you write something like<br>
><br>
>    r = asciistr('(', a)<br>
><br>
> meaning "give me either a string or bytes containing<br>
> the value '(', depending on the type of a".<br>
><br>
> But taking a step back, how bad would it really be<br>
> if an asciistr were returned in this case? Is it<br>
> just that asciistr doesn't behave exactly like a str<br>
> in all situations, so it might break something?<br>
><br>
> If so, would it help if asciistr were a built-in<br>
> type, so that other things could be made aware of<br>
> it?</p>
<p dir="ltr">That way lies the Python 2 text model, and we're not going there. It's probably best to think of asciistr as a way of demonstrating a rhetorical point about the superiority of the Python 3 text model rather than something that anyone should actually use in production Python 3 code (although, depending on how rough the edges turn out to be, it *might* eventually find a place in some single source 2/3 code bases, as well as in prototype code and personal scripts).</p>

<p dir="ltr">Cheers,<br>
Nick.<br></p>
<p dir="ltr">><br>
> -- <br>
> Greg<br>
><br>
> _______________________________________________<br>
> Python-Dev mailing list<br>
> <a href="mailto:Python-Dev@python.org">Python-Dev@python.org</a><br>
> <a href="https://mail.python.org/mailman/listinfo/python-dev">https://mail.python.org/mailman/listinfo/python-dev</a><br>
> Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/ncoghlan%40gmail.com">https://mail.python.org/mailman/options/python-dev/ncoghlan%40gmail.com</a><br>
</p>