Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Christopher Reimer Newsgroups: comp.lang.python Subject: Re: Differences between Class(Object) and Class(Dict) for dictionary usage? Date: Wed, 27 Apr 2016 20:53:00 -0700 Lines: 18 Message-ID: References: <57216399.1050702@icloud.com> <57217DF7.1030509@stoneleaf.us> <5721891C.1090904@icloud.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de awMI/oWVWNm8r3GOhqgLlgGMCyaIeGx9bRoysVVD+Xyw== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.041 X-Spam-Evidence: '*H*': 0.92; '*S*': 0.00; 'constructor': 0.07; 'notation.': 0.09; 'subject:Object': 0.09; 'throw': 0.09; 'subject: \n ': 0.15; 'kings': 0.16; 'knight': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'something.': 0.16; 'subject:between': 0.16; 'subject:usage': 0.16; 'wrote:': 0.16; 'variable': 0.18; 'object.': 0.22; 'pass': 0.22; 'header:User- Agent:1': 0.26; 'chris': 0.26; 'received:17': 0.27; 'correct': 0.28; 'idea': 0.28; 'dictionary': 0.29; 'notation': 0.29; 'pickle': 0.29; 'code': 0.30; 'guess': 0.31; "can't": 0.32; 'received:10.0.0': 0.32; 'subject:) ': 0.32; 'class': 0.33; "i'll": 0.33; 'received:10.0': 0.34; 'saved': 0.35; 'to:addr :python-list': 0.36; 'subject:?': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'thank': 0.38; 'rather': 0.39; 'to:addr:python.org': 0.40; 'called': 0.40; 'header:MIME- version:1': 0.60; 'your': 0.60; 'charset:windows-1252': 0.62; 'skip:n 10': 0.62; 'more': 0.63; 'results': 0.66; 'worth': 0.67; 'directly.': 0.76; 'header:In-reply-to:1': 0.84; 'ethan': 0.91; 'furman': 0.91; 'subject:Class': 0.91 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-04-28_02:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1015 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1510270003 definitions=main-1604280056 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 In-reply-to: <57217DF7.1030509@stoneleaf.us> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=4d515a; t=1461815580; bh=t1gsrPzZ2OdiUr66RV8RMozFNxf0nnX8/yl/U4V1vVQ=; h=Subject:To:From:Message-id:Date:MIME-version:Content-type; b=jfCoPQ2vNoWaLwqh4wvSQQ4ZJ3TWTatCymC+YGHGP7psfbsiQNMnLk1Lt23Gy6OIV s/Kmv6Dbwg4BKKqLyTSf9lo0YXyFvTt+m9okxEdW+SBKZqytkGc//q1b5uACf5ygJi MHNLtS9WCOSqJW1oVZSLNa+6XbiuY063Am9h51tpZsFyjRuELk+2ida8nUE793kdu0 G6xxBxre8Npo2FoAuEIUCIV6+sWLW5/guM2r5iEzphMe2Ur1xD8YzIUDyq4vNhsbuk MPjbZ6JPIwSLyXpui41MjwSITQPfLB5mX5L9g/YPndOJ63wwyMSuQU1IxiN+nX3yfh dRYwex6npOXfQ== X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <5721891C.1090904@icloud.com> X-Mailman-Original-References: <57216399.1050702@icloud.com> <57217DF7.1030509@stoneleaf.us> Xref: csiph.com comp.lang.python:107749 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.