[issue8839] PyArg_ParseTuple(): remove "t# format

STINNER Victor report at bugs.python.org
Fri May 28 13:04:02 CEST 2010


STINNER Victor <victor.stinner at haypocalc.com> added the comment:

> Given that "y#" is not (yet) in wide-spread use, ...

t# is only used once (in codecs.charbuffer_encode()), whereas y# is used by ossaudiodev, socket and mmap modules (there are 8 functions using y#). There are 46 functions using y* format. y format is not used in Python3.

To me, it looks easier to just drop t# and continue to use y, y* and y# formats in Python3.

> "y#" and "y*" could then be setup as synonyms for "t#" and "t*"

If we have to keep backward compatibility, yes, t# can be kept as a synonym for y#. But I don't think that backward compatibility of the C API is important in Python3 because only few 3rd party modules are compatible with Python3.

--

I prefer to use y, y* and y# formats because they target the *bytes* type (which is the Python3 type to store byte strings), whereas s# is used in Python2 to get text, *str* type.. which are byte strings, but most Python2 programmers consider that the str type is the type of chararacter string. I see the change of s# to y#, as the change from str to bytes (the strict separation between bytes and str).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8839>
_______________________________________


More information about the Python-bugs-list mailing list