[Python-Dev] [Python-checkins] cpython: Move PyUnicode_WCHAR_KIND outside PyUnicode_Kind enum

Victor Stinner victor.stinner at haypocalc.com
Sun Dec 18 20:45:40 CET 2011


On 18/12/2011 20:34, "Martin v. Löwis" wrote:
>> Move PyUnicode_WCHAR_KIND outside PyUnicode_Kind enum
>> What's the rationale for that change? It's a valid kind value, after
> all, and the C convention is that an enumeration lists all valid values
> (else there wouldn't be a need for an enumeration in the first place).

PyUnicode_KIND() only returns PyUnicode_1BYTE_KIND, PyUnicode_2BYTE_KIND 
or PyUnicode_4BYTE_KIND. Outside unicodeobject.c, you are not supposed 
to see PyUnicode_WCHAR_KIND.
For switch/case, it avoids the need of adding a dummy 
PyUnicode_WCHAR_KIND case (or a default case).
Victor


More information about the Python-Dev mailing list

AltStyle によって変換されたページ (->オリジナル) /