<div dir="ltr">For the record, I encouraged this. I see no reason to amend my decision. Only .isascii(), for str, bytes, bytearray. No ascii=<bool> flags to other functions.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jan 31, 2018 at 4:17 AM, Serhiy Storchaka <span dir="ltr"><<a href="mailto:storchaka@gmail.com" target="_blank">storchaka@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">31.01.18 13:18, INADA Naoki пише:<span class=""><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Yes.  But .isascii() will be match faster than try ...<br>
.encode('ascii') ... except UnicodeEncodeError<br>
on most Python implementations.<br>
</blockquote>
<br></span>
In this case this doesn't matter since this is an exceptional case, and in any case an exception is raised for non-ascii string.<br>
<br>
But you are true that str.isascii() can be faster than str.encode(), and encoding is not required for converting to int.<span class=""><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Other possibility -- adding support of the boolean argument in str.isdigit()<br>
and similar predicates that switch them to the ASCII-only mode. Such option<br>
will be very useful for the str.strip(), str.split() and str.splilines()<br>
methods. Currently they split using all Unicode whitespaces and line<br>
separators, but there is a need to split only on ASCII whitespaces and line<br>
separators CR, LF and CRLF. In case of str.strip() and str.split() you can<br>
just pass the string of whitespace characters, but there is no such option<br>
for str.splilines().<br>
<br>
</blockquote>
<br>
It sounds good idea.  Maybe, keyword only argument `ascii=False`?<br>
</blockquote>
<br></span>
There is an issue for str.splilines() (don't remember the number). The main problem was that I was not sure about an obvious argument name.<span class=""><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
But if revert adding str.isascii() from Python 3.7, same keyword-only<br>
argument should be<br>
added to int(), float(), decimal.Decimal(), fractions.Fraction(),<br>
etc...  It's bit hard.<br>
</blockquote>
<br></span>
Ah, it is already committed. Then I think it is too later to revert this. I had doubts about this feature and were -0 for adding it (until we discuss it more), but since it is added I don't see much benefit from removing it.<div class="HOEnZb"><div class="h5"><br>
<br>
______________________________<wbr>_________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer" target="_blank">https://mail.python.org/mailma<wbr>n/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/codeofco<wbr>nduct/</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">--Guido van Rossum (<a href="http://python.org/~guido" target="_blank">python.org/~guido</a>)</div>
</div>