[Python-Dev] Re: an idea for improving struct.unpack api
On Wed, 5 Jan 2005 21:27:16 -0800 (PST), Ilya Sandler <[EMAIL PROTECTED]> wrote: >The current struct.unpack api works well for unpacking C-structures where >everything is usually unpacked at once, but it >becomes inconvenient when unpacking binary files where things >often have to be unpacked field by field. It may be helpful to remember Sam Rushings NPSTRUCT extension which accompanied the Calldll module of that time (2001). Still available from http://www.nightmare.com/~rushing/dynwin/ mb - Martin ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] Re: csv module TODO list
I'd love to see a 'split' and a 'join' function in the csv module to just convert between string and list without having to bother about files. Something like csv.split(aStr [, dialect='excel'[, fmtparam]]) -> list object and csv.join(aList, e[, dialect='excel'[, fmtparam]]) -> str object Feasible? mb - Martin ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] Re: csv module TODO list
On Mon, 10 Jan 2005 10:37:17 +1100, Andrew McNamara <[EMAIL PROTECTED]> wrote: >>csv.join(aList, e[, dialect='excel'[, fmtparam]]) -> str object Oops, should have been csv.join(aList [, dialect='excel'[, fmtparam]]) -> str object >Yes, it's feasible, Good! >although newlines can be embedded in within fields >of a CSV record, hence the use of the iterator, rather than working with >strings. In my use cases newlines usually don't come into play. It would be ok for me if they were treated as any other char. > In your example above, if the parser gets to the end of the >string and finds it's still within a field, I'd propose just raising >an exception. Yes, that seems to be "the right answer". >No promises, however - I only have a finite ammount of time to work on >this at the moment. Sure! To my feeling these "intelligent split and join" functions most naturally should actually be string methods. I can see that - considering the conceivable variety of dialects - this can't be done. One more reason to have 'split' and 'join' available from the csv module! mb - Martin ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
