[New-bugs-announce] [issue12740] Add struct.Struct.nmemb

Stefan Krah report at bugs.python.org
Fri Aug 12 13:33:27 CEST 2011


New submission from Stefan Krah <stefan-usenet at bytereef.org>:

It is somewhat complicated to calculate the number of members in
a Struct, so I propose to add Struct.nmemb (in 3.3, 3.2 and 2.7):

>>> import struct
>>> s = struct.Struct("Pxx3Lxxxx3s")
>>> s.size
47
>>> s.nmemb
5


I chose 'nmemb' because it is a standard name in Unix man pages.
Another option would be to spell it out ('nmembers').

----------
components: Library (Lib)
files: struct_nmemb.diff
keywords: needs review, patch
messages: 141951
nosy: mark.dickinson, skrah
priority: normal
severity: normal
stage: patch review
status: open
title: Add struct.Struct.nmemb
type: feature request
versions: Python 3.2, Python 3.3
Added file: http://bugs.python.org/file22890/struct_nmemb.diff

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


More information about the New-bugs-announce mailing list