Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > What is the purpose of "struct" and "array" modules

Reply
Thread Tools

What is the purpose of "struct" and "array" modules

 
 
Igor Katson
Guest
Posts: n/a
 
      05-28-2009
I pretty much understand what they do, but what's the case of using
these modules by example? Is it something like pickle, to store the data
efficiently in files?
 
Reply With Quote
 
 
 
 
Matimus
Guest
Posts: n/a
 
      05-28-2009
On May 28, 11:17*am, Igor Katson <descent...@gmail.com> wrote:
> I pretty much understand what they do, but what's the case of using
> these modules by example? Is it something like pickle, to store the data
> efficiently in files?


For one it provides a mechanism for reading and writing arbitrary file
formats. For example, suppose you wanted to parse a PNG image using
python code. It is likely that that format is described in its
specification using C data structures (I've never looked at PNG format
specifically). In python you can't just read out some data and copy it
directly into a data structure. You could use the struct module
though.

It really has nothing to do with serializing python data structures.
It is (mostly) about data formats and objects defined in other
languages.

Matt
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Big projects divided into modules and sub-modules ImpalerCore C Programming 0 03-10-2011 03:01 PM
Re: (updated) Choosing a collection of common modules/packages for ageneral purpose reusable PY2EXE runtime python@bdurham.com Python 2 03-20-2010 12:46 PM
Importing modules from within other modules Tobiah Python 2 09-14-2003 09:18 PM
imputils - import problem modules from sys.modules Remy Cool Python 1 08-27-2003 02:25 PM



Advertisments