>>>>> "MAL" == M <mal@lemburg.com> writes: >> + def _is8bitstring(s): + if isinstance(s, StringType): + try: >> + unicode(s, 'us-ascii') MAL> Note that 'ascii' will be faster since there are short-cuts MAL> in the C code which map this directly to the ASCII codec. Ah cool, thanks for the tip. I'll make that change. >> + except UnicodeError: + return True + return False + MAL> Since this kind of function occurs quite often in string MAL> related code, wouldn't be better to code it in C and MAL> publish it through e.g. the _codecs module ?! Probably so, or something like it. I'll see if I can't factor out the tests I tend to do and make a proposal. -Barry
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4