Path: csiph.com!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.kamp.net!newsfeed.kamp.net!fu-berlin.de!uni-berlin.de!not-for-mail From: Christopher Reimer Newsgroups: comp.lang.python Subject: Re: How much sanity checking is required for function inputs? Date: Sat, 23 Apr 2016 18:45:37 -0700 Lines: 23 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> <1461291613.433097.586174185.01BB7E37@webmail.messagingengine.com> <57199BA5.4000703@icloud.com> <1461302724.477236.586265777.181ACCA0@webmail.messagingengine.com> <571C2541.9050309@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 S7d2ponNnD1zdiuO44z41Q9oetMTjDuUSej5YR2791Nw== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.079 X-Spam-Evidence: '*H*': 0.84; '*S*': 0.00; 'classes.': 0.07; 'must.': 0.07; 'scripts': 0.09; 'subject:How': 0.09; 'python': 0.10; 'java,': 0.15; 'hell.': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subclassing': 0.16; 'subject:required': 0.16; 'wrote:': 0.16; 'java': 0.22; 'code.': 0.23; 'wrote': 0.23; 'academic': 0.23; 'demonstrate': 0.23; "i've": 0.25; 'header:User- Agent:1': 0.26; 'chris': 0.26; 'received:17': 0.27; 'translated': 0.27; 'classes': 0.30; 'creating': 0.30; 'code': 0.30; 'received:10.0.0': 0.32; 'class': 0.33; 'problem': 0.33; 'michael': 0.33; 'programming,': 0.33; 'weeks': 0.34; 'received:10.0': 0.34; 'advice': 0.35; 'could': 0.35; 'but': 0.36; 'project': 0.36; 'there': 0.36; 'basic': 0.36; 'to:addr:python- list': 0.36; 'subject:?': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'two': 0.37; 'turn': 0.37; 'someone': 0.38; 'thank': 0.38; 'build': 0.40; 'to:addr:python.org': 0.40; 'where': 0.40; 'header:MIME-version:1': 0.60; 'ever': 0.60; 'your': 0.60; 'research': 0.62; 'charset:windows-1252': 0.62; 'course': 0.62; 'more': 0.63; 'day': 0.67; 'useful.': 0.72; 'collapsing': 0.84; 'endeavor.': 0.84; 'header:In-reply-to:1': 0.84; 'lifelong': 0.84; 'literature': 0.84; 'confront': 0.91; 'subject:much': 0.91 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-04-24_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-1604240027 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 In-reply-to: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=4d515a; t=1461462335; bh=n+Rywv3QodpZFiNVyctd9Wk3OJ0+/UJP7EMBCj7sgGk=; h=Subject:To:From:Message-id:Date:MIME-version:Content-type; b=nL1QObYRCJvxDh3dd9McH8ZIISRAem6b+xTAsawRIoTllMgVyDQzrHL0Pezhgxspt /P9x8nzoMGgDf+OI/kEsvp/L7er1LNHCzEI7jeux0r9QnpvjgO4l44I9QP4rGKNokr JlWrBbMCJN30yqLQn/3wv+7ckq2cgPodxsIjcHAA86bh61AUz90t2Ojodl2znEbvq1 04wlkP/GMsSYq+D7qryxrBkG3EMV0et1ZHfjPAVj8E61S8poL735f1Z6ryeC7yZ52l RmgYQW49o838RBPY6zwE2axOa0/D7j8m7NKEB2ItCsFNBEw+UlKwd/hOKQCRzBDpEM 0jFdUTTz7Oa4g== 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: <571C2541.9050309@icloud.com> 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> <1461291613.433097.586174185.01BB7E37@webmail.messagingengine.com> <57199BA5.4000703@icloud.com> <1461302724.477236.586265777.181ACCA0@webmail.messagingengine.com> Xref: csiph.com comp.lang.python:107527 On 4/22/2016 1:40 PM, Michael Selik wrote: > Frankly, for someone coming from Java, the best advice is to not write any > classes until you must. Of course classes in Python are very useful. It's > just that your Java habits are unnecessary and often counter-productive. I disagree. I wrote procedural scripts and translated old BASIC games into Python for two years. One day I came across a Python book that described the principles of subclassing from a base class for chess pieces, but there was no code to demonstrate the process. I had no problem creating the Python classes. That's how my research project got started to build a chess engine. If you ever check the academic literature for chess programming, this research project could turn into a lifelong endeavor. I had to confront all the bad habits I brought over Java and change my code to be more Pythonic. This is where I started having fun, learning the tricks and collapsing multi-line code into a single line code. I've learned more about Python in the few weeks than I had in two years of writing procedural scripts and translating BASIC goto hell. Thank you, Chris R.