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


Groups > comp.lang.python > #107531

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

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Michael Torrie <torriem@gmail.com>
Newsgroups comp.lang.python
Subject Re: How much sanity checking is required for function inputs?
Date Sat, 23 Apr 2016 20:34:48 -0600
Lines 27
Message-ID <mailman.24.1461465315.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>
Mime-Version 1.0
Content-Type text/plain; charset=windows-1252
Content-Transfer-Encoding 7bit
X-Trace news.uni-berlin.de ydCfysVevmAf+TIKV4AcIAV0xRJMmCzUmqKiGz6pJ3yQ==
Return-Path <torriem+gmail@torriefamily.org>
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; '*not*': 0.07; 'classes.': 0.07; 'scripts': 0.09; 'subject:How': 0.09; 'namespace': 0.09; 'python': 0.10; 'advocating': 0.16; 'event-driven': 0.16; 'from:addr:torriem': 0.16; 'from:name:michael torrie': 0.16; 'hell.': 0.16; 'mechanism.': 0.16; 'mistake.': 0.16; 'object).': 0.16; 'pythonic': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'sadly': 0.16; 'singleton': 0.16; 'subject:required': 0.16; 'wrote:': 0.16; 'instance,': 0.18; 'say,': 0.18; '(the': 0.22; 'java': 0.22; 'programming': 0.22; 'code.': 0.23; 'header:In- Reply-To:1': 0.24; 'all.': 0.24; 'module': 0.25; "i've": 0.25; 'header:User-Agent:1': 0.26; 'example': 0.26; 'defining': 0.27; 'about.': 0.29; "people's": 0.29; 'classes': 0.30; 'that.': 0.30; 'code': 0.30; 'class': 0.33; 'programming,': 0.33; 'message- id:@gmail.com': 0.34; 'weeks': 0.34; 'quite': 0.35; 'something': 0.35; 'but': 0.36; 'there': 0.36; 'basic': 0.36; 'framework': 0.36; 'modules': 0.36; "wasn't": 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'two': 0.37; 'say': 0.37; 'received:org': 0.37; 'aspects': 0.37; 'doing': 0.38; 'mean': 0.38; 'shared': 0.38; 'why': 0.39; 'sure': 0.39; 'does': 0.39; 'received:192': 0.39; 'rather': 0.39; 'to:addr:python.org': 0.40; 'where': 0.40; 'still': 0.40; 'your': 0.60; 'yes': 0.62; 'charset:windows-1252': 0.62; 'more': 0.63; 'necessarily': 0.63; 'collapsing': 0.84; 'messed': 0.84; 'confront': 0.91; 'subject:much': 0.91; 'mr.': 0.99
X-Virus-Scanned amavisd-new at torriefamily.org
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2
In-Reply-To <571C2541.9050309@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 <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 <571C30C8.5000208@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> <CAGgTfkNz5aeS5Jo+3yc+nWjUKnfhe=0zBVNeNHUMHD6Uj9VyEA@mail.gmail.com> <571C2541.9050309@icloud.com>
Xref csiph.com comp.lang.python:107531

Show key headers only | View raw


On 04/23/2016 07:45 PM, Christopher Reimer wrote:
> 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.

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.  However, Mr. Selik wasn't advocating
procedural programming at all.  Not defining a class does not make your
code precdural.  But using classes does not mean your code is *not*
procedural. If you are using an event-driven framework then I will say,
yes your code is not procedural.

There are many aspects to Pythonic programming, not just OOP.  For
example using modules to store shared state for your program components
is very pythonic, rather than using classes.  A module is kind of like a
singleton instance, and still is object-oriented by the way (the module
is an object).  Sadly Java really messed up people by using classes as a
namespace mechanism.  That was quite a mistake.  Really messed with
people's expectations of OOP.

I would say that pythonic programming involves defining classes when
it's appropriate, and not doing so when something else will work just as
well and be simpler.

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


Thread

Re: How much sanity checking is required for function inputs? Michael Torrie <torriem@gmail.com> - 2016-04-23 20:34 -0600
  Re: How much sanity checking is required for function inputs? Steven D'Aprano <steve@pearwood.info> - 2016-04-24 15:49 +1000
    Re: How much sanity checking is required for function inputs? Michael Selik <michael.selik@gmail.com> - 2016-04-24 06:40 +0000
      Re: How much sanity checking is required for function inputs? Steven D'Aprano <steve@pearwood.info> - 2016-04-25 04:00 +1000
        Re: How much sanity checking is required for function inputs? Michael Selik <michael.selik@gmail.com> - 2016-04-25 01:02 +0000

csiph-web