This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author methane
Recipients methane
Date 2018-01-26.11:09:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1516964948.19.0.467229070634.issue32677@psf.upfronthosting.co.za>
In-reply-to
Content
int() and str.is*** functions accepts other than ASCII.
But we want to accept only ASCII in some cases.  (e.g. ipaddress module)

We can use try-except to check ASCII, but it's inefficient.

try:
    s.encode('ascii')
except UnicodeEncodeError:
    ascii = False
else:
    ascii = True

CPython can check string is ASCII efficiently.

(Voting on python-ideas ML now)
History
Date User Action Args
2018-01-26 11:09:08methanesetrecipients: + methane
2018-01-26 11:09:08methanesetmessageid: <1516964948.19.0.467229070634.issue32677@psf.upfronthosting.co.za>
2018-01-26 11:09:08methanelinkissue32677 messages
2018-01-26 11:09:08methanecreate