New submission from INADA Naoki <songofaca...@gmail.com>: 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) ---------- components: Interpreter Core messages: 310754 nosy: inada.naoki priority: normal severity: normal status: open title: Add str.isascii() type: enhancement versions: Python 3.7 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue32677> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com