A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2004-June/045147.html below:

[Python-checkins] python/dist/src/Include unicodeobject.h, 2.42, 2.43

[Python-Dev] Re: [Python-checkins] python/dist/src/Include unicodeobject.h, 2.42, 2.43Skip Montanaro skip at pobox.com
Wed Jun 2 13:41:44 EDT 2004
    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

More information about the Python-Dev mailing list

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