Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #107538
| From | Marko Rauhamaa <marko@pacujo.net> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: How much sanity checking is required for function inputs? |
| Date | 2016-04-24 08:56 +0300 |
| Organization | A noiseless patient Spider |
| Message-ID | <8737qby2gn.fsf@elektro.pacujo.net> (permalink) |
| References | (7 earlier) <5719964E.2050400@icloud.com> <CAG93HwHmQUABxKwDdWEbdTJ0gDQVcUW52uqjGLC6j8b53MPh4g@mail.gmail.com> <571C2957.7060508@icloud.com> <mailman.21.1461463390.32212.python-list@python.org> <571c5bd3$0$1602$c3e8da3$5496439d@news.astraweb.com> |
Steven D'Aprano <steve@pearwood.info>: > 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. You shouldn't use your runtime objects as a storage format. Instead, design the storage objects separately and translate between runtime and storage objects as needed. JSON objects or straight Python dicts are good candidates for overall storage format. JSON would allow for easy interchange between different programming languages if need be. Marko
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: How much sanity checking is required for function inputs? Christopher Reimer <christopher_reimer@icloud.com> - 2016-04-23 19:03 -0700
Re: How much sanity checking is required for function inputs? Steven D'Aprano <steve@pearwood.info> - 2016-04-24 15:38 +1000
Re: How much sanity checking is required for function inputs? Marko Rauhamaa <marko@pacujo.net> - 2016-04-24 08:56 +0300
csiph-web