php equivalents?

Kevin Howe khowe at perfnet.ca
Thu Apr 24 10:35:19 EDT 2003


Hi,

I'm switching from PHP to Python, and am wondering if there are Python
equivalents to the following two PHP functions:

> register_shutdown($func)

This is basically a "cleanup" function. Just before a script ends, it will
invoke all functions registered using register_shutdown(). This can be used
to close database connections, clear sessions, save data, etc.

> var_export($var)

This function converts a variable to a text string of valid code which can
be reevaluated at any time. Python has pickle/cPickle, and also has modules
that can dump/load to XML, however, none of these create actual code, but
instead create a formatted data string.

Any help is much appreciated.

- Kevin








More information about the Python-list mailing list