M
Mike Tammerman
I want to serialize a function using its pointer. For example
.... def square(number):
.... return number**2
.... """
Then,
1. Serialize f,
2. Store it into a file a db.
One day later,
3. Retrieve from file or db,
4. Unserialize it
5. Use as it is a normal function, maybe I would set it to an object
with setattr
Any help will be very useful.
Mike
.... def square(number):
.... return number**2
.... """
<function square at 0xb7b5d10c>functions = {}
exec s in functions
f = functions['square']
f
Then,
1. Serialize f,
2. Store it into a file a db.
One day later,
3. Retrieve from file or db,
4. Unserialize it
5. Use as it is a normal function, maybe I would set it to an object
with setattr
Any help will be very useful.
Mike