New submission from Stefan Krah <stefan-use...@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 <rep...@bugs.python.org>
<http://bugs.python.org/issue12740>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to