Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #107749

Re: Differences between Class(Object) and Class(Dict) for dictionary usage?

From Christopher Reimer <christopher_reimer@icloud.com>
Newsgroups comp.lang.python
Subject Re: Differences between Class(Object) and Class(Dict) for dictionary usage?
Date 2016-04-27 20:53 -0700
Message-ID <mailman.167.1461815583.32212.python-list@python.org> (permalink)
References <57216399.1050702@icloud.com> <57217DF7.1030509@stoneleaf.us> <5721891C.1090904@icloud.com>

Show all headers | View raw


On 4/27/2016 8:05 PM, Ethan Furman wrote:
> I ripped out the fetch_state because that will take more work -- you 
> can't pass a Pawn's saved state in to Piece and get the results you 
> want.  pickle is worth looking at for saving/restoring.

The original idea was to pass a Pawn dictionary to the constructor of 
the Pawn object. The Piece object will throw a NotImplementedError if 
called directly. I guess I'll have to look at pickle sooner rather than 
later.

> Also, your code will give the same notation to Kings and Knights.

Good catch. I knew I was forgetting something. I overrode variable in 
the Knight class to produce the correct notation.

Thank you,

Chris R.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Differences between Class(Object) and Class(Dict) for dictionary usage? Christopher Reimer <christopher_reimer@icloud.com> - 2016-04-27 20:53 -0700

csiph-web