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


Groups > comp.lang.python > #107510

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

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Michael Selik <michael.selik@gmail.com>
Newsgroups comp.lang.python
Subject Re: How much sanity checking is required for function inputs?
Date Fri, 22 Apr 2016 20:40:45 +0000
Lines 26
Message-ID <mailman.6.1461357665.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>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de UEL5cptDOZP4pyDAGkt0oAgrIsh5V+QtWnUsLJ/U2z2A==
Return-Path <michael.selik@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.006
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; '21,': 0.07; 'must.': 0.07; 'pretend': 0.07; 'subject:How': 0.09; '22,': 0.09; 'globals': 0.09; 'python': 0.10; 'systems.': 0.11; 'java,': 0.15; 'thu,': 0.15; 'pythonic': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:required': 0.16; 'wrote:': 0.16; '&gt;': 0.18; 'to:2**1': 0.21; 'java': 0.22; 'stephen': 0.22; 'header:In-Reply- To:1': 0.24; "doesn't": 0.26; 'fri,': 0.27; 'message- id:@mail.gmail.com': 0.27; 'went': 0.28; 'helpful.': 0.29; 'there.': 0.30; 'classes': 0.30; "i'd": 0.31; 'certain': 0.31; "can't": 0.32; 'generally': 0.32; 'useful': 0.33; 'that!': 0.33; 'except': 0.34; 'advice': 0.35; 'received:google.com': 0.35; 'functions.': 0.35; 'received:209.85': 0.36; 'to:addr:python- list': 0.36; 'subject:?': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'things': 0.38; 'received:209': 0.38; 'someone': 0.38; 'received:209.85.220': 0.38; 'to:addr:python.org': 0.40; 'some': 0.40; 'forget': 0.60; 'your': 0.60; 'internet,': 0.61; 'course': 0.62; 'useful.': 0.72; 'yourself': 0.73; 'url:03': 0.84; 'subject:much': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=vZYhBEtf1L0P9Cxe5CXC3EviCW4n2reFw9b9WoDQIRQ=; b=sineWQ+tDW4NOh7dTul4nywOComQWFA+MqCi0GaT014c3s8MzIFkkoHDrGWD6IZNCL 9noEeoPhBB0DonxoIyLiB42cYoH/IXLhO978kxaTIK1XZSV7xvWmoeDT1oQ1XmJP4Yqo ZiwcJk/D4ZVnsbD49Y3x+uGrBdlInaLKCnLE4pg3rhRLzhuzsTJGGCKtiTV5nscIakG1 GMhfQGzVK1aEItjVNY7QGmNGL3ab4gAMvIEPwki54m/urjAAsgqpcttPFjE7HZs9IfSx X63DI5skjtlA3QE+rEwiPZhs6qt6UYXRP6flz+XzsSOCHykmCLa/CjcarTELwW29A47g mnBw==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=vZYhBEtf1L0P9Cxe5CXC3EviCW4n2reFw9b9WoDQIRQ=; b=D+zLaX3Qtq/pdT0MLNcSy21w8lyc0v0mYuW5vlYG6a2U9PCw6Pa+cETvyhtTFedwzE v9c5C4XvxFEMEprIIzgqKUTU3ySrMOsGojm3wEHaWnO4ULgZhWFwy5FDkHLw0w1jMPLs nMxf2N7kSe7fqphig1GqXDKcBJ1rP7yvHmIN/eQ9wZEP0UYwOzCQCsPtK0tNQML9C2nm HN3LA2NXiqwRgoO30bLHMNPa7q1l6KD+6QcPevS9q576sqmQKFA8QnlVw2kHX62HFSx5 TihJBhmNzlIR+hk/Tc4MnNxA7WDBFML3N9UKLd4JdKrOyqBRY3DYDwhpHaNuZ2LQan7M J/Tw==
X-Gm-Message-State AOPr4FVlyIUi0Uq337wqIZjLVfrzofB8IzhgtlkQIq6zg519LrvT9d3KnZps1aaKYIqfiNK9JEeE5FvSREOf/Q==
X-Received by 10.55.151.199 with SMTP id z190mr6332144qkd.172.1461357655079; Fri, 22 Apr 2016 13:40:55 -0700 (PDT)
In-Reply-To <1461302724.477236.586265777.181ACCA0@webmail.messagingengine.com>
X-Content-Filtered-By Mailman/MimeDel 2.1.22
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 <CAGgTfkNz5aeS5Jo+3yc+nWjUKnfhe=0zBVNeNHUMHD6Uj9VyEA@mail.gmail.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:107510

Show key headers only | View raw


On Fri, Apr 22, 2016, 1:26 AM Stephen Hansen <me@ixokai.io> wrote:

> On Thu, Apr 21, 2016, at 08:33 PM, Christopher Reimer wrote:
> > On 4/21/2016 7:20 PM, Stephen Hansen wrote:
> > > I... that... what... I'd forget that link and pretend you never went
> > > there. Its not helpful.
> >
> > I found it on the Internet, so it must be true -- and Pythonic at that!
>
> My advice is to not look at that site further. I can't count the number
> of things that are just... not useful or helpful.
>
> Directly translating the Gang of Four Design Pattern book to Python
> doesn't generally result in useful ideas, except in certain abstractions
> like the visitor pattern when you're designing big systems.
>

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.

Just make some globals and some functions. Heck, even write procedurally
for a while. Free yourself from the Kingdom of Nouns.
http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html

>

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


Thread

Re: How much sanity checking is required for function inputs? Michael Selik <michael.selik@gmail.com> - 2016-04-22 20:40 +0000

csiph-web