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


Groups > comp.lang.python > #107532

Re: How much sanity checking is required for function inputs?

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Christopher Reimer <christopher_reimer@icloud.com>
Newsgroups comp.lang.python
Subject Re: How much sanity checking is required for function inputs?
Date Sat, 23 Apr 2016 20:19:14 -0700
Lines 22
Message-ID <mailman.25.1461467961.32212.python-list@python.org> (permalink)
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> <CAGgTfkNz5aeS5Jo+3yc+nWjUKnfhe=0zBVNeNHUMHD6Uj9VyEA@mail.gmail.com> <571C2541.9050309@icloud.com> <571C30C8.5000208@gmail.com> <571C3B32.4040306@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 NDdd7zTEUQ1GrnwrryFEzQvcTQzRxeF8LQVb46nX95Aw==
Return-Path <christopher_reimer@icloud.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.055
X-Spam-Evidence '*H*': 0.89; '*S*': 0.00; 'python,': 0.02; 'scripts': 0.09; 'subject:How': 0.09; 'python': 0.10; 'complains': 0.16; 'example).': 0.16; 'hell.': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:required': 0.16; 'helper': 0.18; '(see': 0.20; 'programming': 0.22; 'wrote': 0.23; 'header:User- Agent:1': 0.26; 'sense': 0.26; 'chris': 0.26; 'received:17': 0.27; 'about.': 0.29; 'branches': 0.29; 'that.': 0.30; 'code': 0.30; 'entry': 0.31; 'received:10.0.0': 0.32; 'statement': 0.32; 'point': 0.33; 'michael': 0.33; 'closely': 0.33; 'hell': 0.33; 'shorter': 0.33; 'structure': 0.34; 'received:10.0': 0.34; 'possible,': 0.35; 'sometimes': 0.35; 'url:org': 0.36; 'basic': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'really': 0.37; 'two': 0.37; 'version': 0.38; 'several': 0.38; 'thank': 0.38; 'mean': 0.38; 'why': 0.39; 'sure': 0.39; 'does': 0.39; 'to:addr:python.org': 0.40; 'header:MIME-version:1': 0.60; 'back': 0.62; 'charset:windows-1252': 0.62; 'necessarily': 0.63; 'url:page': 0.72; 'drop-down': 0.84; 'exceeding': 0.84; 'header :In-reply-to:1': 0.84; 'url:php': 0.86; 'dozen': 0.91; 'subject:much': 0.91
X-Proofpoint-Virus-Version vendor=fsecure engine=2.50.10432:,, definitions=2016-04-24_03:,, 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-1604240055
User-Agent Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2
In-reply-to <571C30C8.5000208@gmail.com>
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=4d515a; t=1461467953; bh=CD5R80yU2kSjQy4uclMZETUEncsyasvjPtWXpL4Hfhs=; h=Subject:To:From:Message-id:Date:MIME-version:Content-type; b=A2ntR2d5jikLPna11keTVqJgyDDGE++/m6zzOtTgq5Zq3cmM/DPtsObCWb9MGXbBx yO7yaeO+QjvqztBs6mL0sUcQcPXygxnoRrIggbxMcqH3lAEU/XGmQKeWPApSk9z/eh y/jjAzwwfGGRAFTmVxMg7zNG+z41lXHRT/xo8FrN/icAEST5D5c88SnWz+uxMxu1V9 O8jn6bF1qpoiw0p0KrMTlO3lKkjF3DRhb6eNWax+D8p4M80Qn8I2mQeTLTdg6m5FEe P1kRKkYcyHUUSBk8ptwUNnMc2krIZQH+C8VynzXd23e0H3j2/ruV6W17qlOwWT5CeK dy6EW8VVHfFXA==
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.22
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID <571C3B32.4040306@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> <CAGgTfkNz5aeS5Jo+3yc+nWjUKnfhe=0zBVNeNHUMHD6Uj9VyEA@mail.gmail.com> <571C2541.9050309@icloud.com> <571C30C8.5000208@gmail.com>
Xref csiph.com comp.lang.python:107532

Show key headers only | View raw


On 4/23/2016 7:34 PM, Michael Torrie wrote
> Procedural programming does not necessarily mean BASIC-style goto hell.
> Not sure why you would think that.  In fact that's not really what
> procedural programming is about.

I mentioned several messages back that I spent two years writing 
procedural scripts AND translating BASIC games into Python, which can be 
goto hell if the program has a drop-down structure that makes sense only 
from following the entry point of the goto statement (see link for example).

http://www.atariarchives.org/basicgames/showpage.php?page=9

I try to follow the BASIC program structure as closely as possible, get 
it working in Python, and use pylint to make my code PEP8-compliant. 
Pylint frequently complains about exceeding a dozen if branches in the 
main function. I then create helper functions to reduce the if branches. 
Sometimes that makes the Python version either shorter or longer than 
the original BASIC program.

Thank you,

Chris R.

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


Thread

Re: How much sanity checking is required for function inputs? Christopher Reimer <christopher_reimer@icloud.com> - 2016-04-23 20:19 -0700

csiph-web