perky> - SF #962502: Add two more methods for unicode type; width() and perky> iswide() for east asian width manipulation. Skip> Should strings grow these methods as well for symmetry? Hye-Shik> I think there'll be two possible behaviors for strings: Hye-Shik> 1) regard all characters as non-wide. Hye-Shik> 2) decode the string to unicode with the system default encoding Hye-Shik> and call its methods. ... Hye-Shik> I didn't make my mind between these two yet. What do you think? #1 sounds like the most reasonable to me. You can't rely on strings coming into your program with proper encoding information, and they might come from an environment different than sys.defaultencoding (think WWW), so #2 seems like it would create as many problems as it solves. All I'm interested in is avoiding needless occurrences of these constructs in code: if isinstance(s, unicode): width = s.width() else: ... or try: width = s.width() except AttributeError: ... Skip
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