[issue12740] Add struct.Struct.nmemb

Antoine Pitrou report at bugs.python.org
Sun Aug 14 20:17:33 CEST 2011


Antoine Pitrou <pitrou at free.fr> added the comment:

> It looks like the choice is between s.nmembers and len(s). I thought
> about len(s), but since Struct.pack() returns a bytes object, this
> might be confusing.

I agree there's a risk of confusion between len()-number-of-elements and
size()-number-of-bytes.
We have a similar confusion with the memoryview object and in retrospect
it's often quite misleading.

----------

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


More information about the Python-bugs-list mailing list