¡@

Home 

python Programming Glossary: marshal

How to pickle a python function with its dependencies?

http://stackoverflow.com/questions/10048061/how-to-pickle-a-python-function-with-its-dependencies

where I am writing a functions byte code to a file using marshal def g self blah print blah def f self for i in range 1 5 print.. 1 5 print 'some function f' g 'some string used by g' data marshal.dumps f.func_code file open ' tmp f2.txt' 'w' file.write data.. python instance I do file open ' tmp f2.txt' 'r' code marshal.loads file.read func2 types.FunctionType code globals some_func_name..

Is there an easy way to pickle a python function (or otherwise serialize its code)?

http://stackoverflow.com/questions/1253528/is-there-an-easy-way-to-pickle-a-python-function-or-otherwise-serialize-its-cod

bytecode and then reconstruct it on the caller. The marshal module can be used to serialise code objects which can then.. which can then be reassembled into a function. ie import marshal def foo x return x x code_string marshal.dumps foo.func_code.. ie import marshal def foo x return x x code_string marshal.dumps foo.func_code Then in the remote process after transferring..

How to load compiled python modules from memory?

http://stackoverflow.com/questions/1830727/how-to-load-compiled-python-modules-from-memory

string b to an importable module ciao . Here's how import marshal c marshal.loads b 8 c code object module at 0x65188 file ciao.py.. to an importable module ciao . Here's how import marshal c marshal.loads b 8 c code object module at 0x65188 file ciao.py line.. warranted but that seems outside the scope of the question marshal.loads will raise anyway if it detects a corrupt string . Then..

Jinja2 in Google App Engine

http://stackoverflow.com/questions/2365774/jinja2-in-google-app-engine

but I read somewhere that bytecode caching depends on the marshal module which is not supported in App Engine. This answer to.. question provides a possible solution by changing marshal to use pickle methods. Has anyone tried this In general is there..

Extract the SHA1 hash from a torrent file

http://stackoverflow.com/questions/2572521/extract-the-sha1-hash-from-a-torrent-file

is the serialization format used in .torrent files. It can marshal lists dictionaries strings and numbers somewhat like JSON. The..

Return a list of imported Python modules used in a script?

http://stackoverflow.com/questions/2572582/return-a-list-of-imported-python-modules-used-in-a-script

thread StringIO bisect pickle signal traceback difflib marshal linecache itertools dummy_thread posix doctest unittest time..

Why is marshal so much faster than pickle? [closed]

http://stackoverflow.com/questions/329249/why-is-marshal-so-much-faster-than-pickle

is marshal so much faster than pickle closed From this question and my.. From this question and my own benchmarks it seems that the marshal module is about 20 30x faster than cPickle. Why is this so What.. Why is this so What functionality does cPickle offer over marshal that justifies this Another way of putting it why not always..

We need to pickle any sort of callable

http://stackoverflow.com/questions/6234586/we-need-to-pickle-any-sort-of-callable

computing share improve this question You could marshal the bytecode and pickle the other function things import marshal.. the bytecode and pickle the other function things import marshal import pickle marshaled_bytecode marshal.dumps your_function.func_code.. the other function things import marshal import pickle marshaled_bytecode marshal.dumps your_function.func_code # In this process..