How much sanity checking is required for function inputs?

Steven D'Aprano steve at pearwood.info
Sun Apr 24 01:38:25 EDT 2016


On Sun, 24 Apr 2016 12:03 pm, Christopher Reimer wrote:

> On 4/23/2016 2:33 PM, Matt Wheeler wrote:
>> This is still backwards to me. It prevents your classes from being
>> suitable for restoring a stored game state, not just custom starting
>> positions (which I think is what Ethan means by custom setups).
> 
> I haven't thought that far about saving the game state. I'm under the
> impression that pickle (or something else) would save and load the
> instantiated object of each piece. If that's not the case, I'll change
> the code then.

Pickle will do what you are thinking of, but pickle is not secure and
involves executing arbitrary code. If you cannot trust the source of the
pickle, then you should not use it.



-- 
Steven




More information about the Python-list mailing list