[issue28959] Add a macro for dict size
STINNER Victor
report at bugs.python.org
Wed Dec 14 03:57:47 EST 2016
STINNER Victor added the comment:
> Should we use Py_SIZE or _PyDict_GET_SIZE?
I prefer _PyDict_GET_SIZE() just to make the code more readable: it helps to repeat the type of variables.
Moreover, it can give you a free check on the type if you agree my suggestion to add an assertion into the macro directly.
Technically, it's already possible to use Py_SIZE() on lists and tuples, but PyTuple_GET_SIZE() and PyList_GET_SIZE() are used almost everywhere, again, for readability.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28959>
_______________________________________
More information about the Python-bugs-list
mailing list