[Python-Dev] Rename PyUnicode_KIND_SIZE ?

Antoine Pitrou solipsis at pitrou.net
Thu Oct 6 15:52:59 CEST 2011


Hello,

The PyUnicode_KIND_SIZE macro is defined as follows. Its name looks
rather mysterious or misleading to me. Could we rename it to something
else?
(also, is it useful? PEP 393 has added a flurry of new macros to
unicodeobject.h and it's getting hard to know which ones are genuinely
useful, or well-performing)


/* Compute (index * char_size) where char_size is 2 ** (kind - 1).
   The index is a character index, the result is a size in bytes.

   See also PyUnicode_CHARACTER_SIZE(). */
#define PyUnicode_KIND_SIZE(kind, index) \
    ((Py_ssize_t) ((index) << ((kind) - 1)))


Regards

Antoine.




More information about the Python-Dev mailing list