Yes, all cool. But,
json.dump(Opts.__dict__, open("mybuffer", "w"))
still doesn't work with python3. Returns "is not JSON serializable"
On Sun, Dec 10, 2017 at 4:00 AM, Steve D'Aprano
wrote:
> On Sun, 10 Dec 2017 04:52 am, MRAB wrote:
>
> > Try updating __dict__:
> >
> > Opts.__dict__.
On Sun, 10 Dec 2017 04:52 am, MRAB wrote:
> Try updating __dict__:
>
> Opts.__dict__.update(json.load(open("mybuffer")))
__dict__ is implementation, vars() is the public interface:
vars(Opts).update(json.load(open("mybuffer")))
Looks nicer too :-)
--
Steve
“Cheer up,” they said, “th
On 2017-12-08 18:36, Bob van der Poel wrote:
I'm trying to something simple (yeah, right). Mainly I want to have a bunch
of variables which my program needs and uses to be in a saveable/loadable
block. Currently I have then all as a bunch of globals which works, but
trying to keep track of them a
Bob van der Poel writes:
> I'm trying to something simple (yeah, right). Mainly I want to have a bunch
> of variables which my program needs and uses to be in a saveable/loadable
> block. Currently I have then all as a bunch of globals which works, but
> trying to keep track of them and the corre
I'm trying to something simple (yeah, right). Mainly I want to have a bunch
of variables which my program needs and uses to be in a saveable/loadable
block. Currently I have then all as a bunch of globals which works, but
trying to keep track of them and the correct spellings, etc becomes a bit
of