[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] map format



Hmmm, just checking the manual of marshal, looks like a Python wrapper with some restriction:
Details of the format are undocumented on purpose; it may change between Python versions (although it rarely does)
- This is not a general ``persistence'' module. ->...  For persistence use the pickle module (which is slow!)
- The marshal module exists mainly to support reading and writing the ``pseudo-compiled'' code for Python modules of .pyc files. 

Found on:
http://www.zvon.org/other/python/doc21/lib/module-marshal.html

Based on that I would consider twice if you want to use such a module, without saying its bad! But for the planned purpose (reading map) I dont see the advantage using the marshal module.

What I forgot to say is the fact that dictionaries (keys) are indexed (hash) what makes them really fast on reading out values. This is surely needed accessing a map many times.

Just 2 other cents
Farai


Am 19.12.2006 um 02:54 schrieb Greg Ewing:

Richard Jones wrote:

Consider reducing your data down to Python builtin types (list, dict, etc.) and use the marshal module instead. It's faster and has none of the potential hassles of pickling.

Although be warned that the marshal format is not
guaranteed to remain the same across Python versions,
so your marshalled maps might have portability
problems.

I don't think it has actually changed in an incompatible
way for a long time, and the chance of it doing so in
the future is probably low, but it could happen.

--
Greg