Path: csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail From: Ethan Furman Newsgroups: comp.lang.python Subject: Re: How much sanity checking is required for function inputs? Date: Thu, 21 Apr 2016 19:10:47 -0700 Lines: 17 Message-ID: References: <5713E52D.3060407@icloud.com> <1461131475.4042173.584042297.03DAB00E@webmail.messagingengine.com> <57171D23.40709@stoneleaf.us> <1461133057.4046578.584060569.2DD34821@webmail.messagingengine.com> <57185E88.30201@yahoo.com> <57197FC3.4030701@icloud.com> <57198827.1020608@stoneleaf.us> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de tvt0w5jKa6KjJo6axinBZAzIwnLu1si2LOeMXdomoQ0Q== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.012 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'exception.': 0.07; 'sanity': 0.07; 'subject:How': 0.09; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'message-id:@stoneleaf.us': 0.09; 'value.': 0.15; 'knight': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:required': 0.16; 'wrote:': 0.16; 'header:In-Reply-To:1': 0.24; 'header:User- Agent:1': 0.26; 'initial': 0.28; '~ethan~': 0.29; 'raise': 0.29; 'class': 0.33; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'skip:p 20': 0.38; 'test': 0.39; 'to:addr:python.org': 0.40; 'your': 0.60; 'charset:windows-1252': 0.62; 'better.': 0.66; 'incorporate': 0.66; 'validate': 0.76; 'positions.': 0.84; 'subject:much': 0.91 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 In-Reply-To: <57197FC3.4030701@icloud.com> 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: <57198827.1020608@stoneleaf.us> X-Mailman-Original-References: <5713E52D.3060407@icloud.com> <1461131475.4042173.584042297.03DAB00E@webmail.messagingengine.com> <57171D23.40709@stoneleaf.us> <1461133057.4046578.584060569.2DD34821@webmail.messagingengine.com> <57185E88.30201@yahoo.com> <57197FC3.4030701@icloud.com> Xref: csiph.com comp.lang.python:107471 On 04/21/2016 06:34 PM, Christopher Reimer wrote: > class PieceFactory(object): > [...] Better. > I do plan to incorporate a sanity test in each Piece class to validate > the initial position value. Pawns have 16 specific positions. Bishop, > Knight and Rook each have four specific positions. King and Queen each > have two specific positions. An invalid value will raise an exception. This will make it so you cannot use your PieceFactory for custom setups. -- ~Ethan~