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


Groups > comp.lang.python > #30652

Re: Are ABCs an anti-pattern?

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; '(at': 0.03; 'patterns': 0.04; '(except': 0.05; '(using': 0.07; 'python': 0.09; 'etc).': 0.09; 'list...': 0.09; 'okay': 0.09; 'oop,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'terry': 0.09; 'throw': 0.09; 'url:peps': 0.09; 'language': 0.14; 'library': 0.15; 'essential': 0.15; 'adapter': 0.16; 'classes)': 0.16; 'doing,': 0.16; 'dropping': 0.16; 'least,': 0.16; 'partly': 0.16; 'pythonic': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'such,': 0.16; 'wrote:': 0.17; 'url:dev': 0.17; 'jan': 0.18; 'obviously': 0.18; 'python?': 0.20; 'all,': 0.21; 'bit': 0.21; 'meant': 0.21; 'uses.': 0.22; 'academic': 0.23; 'seems': 0.23; 'header:In-Reply- To:1': 0.25; 'header:User-Agent:1': 0.26; 'am,': 0.27; '3.0': 0.27; 'header:X-Complaints-To:1': 0.28; 'decline': 0.29; "i'm": 0.29; "we're": 0.30; 'knows': 0.30; 'initially': 0.30; 'up.': 0.31; 'code': 0.31; 'url:python': 0.32; 'belong': 0.33; 'curious': 0.33; 'right?': 0.33; 'strict': 0.33; 'to:addr:python-list': 0.33; 'themselves': 0.33; 'that,': 0.34; '2.0': 0.35; 'so,': 0.35; 'doing': 0.35; 'expected': 0.35; 'subject:?': 0.35; 'received:org': 0.36; 'but': 0.36; 'url:org': 0.36; "wasn't": 0.36; 'anything': 0.36; 'client': 0.36; 'does': 0.37; 'quite': 0.37; 'far': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'subject:-': 0.40; 'header:Received:5': 0.40; 'help': 0.40; 'think': 0.40; 'skip:n 10': 0.63; 'more': 0.63; 'making': 0.64; 'here': 0.65; 'hang': 0.65; 'due': 0.66; 'overall': 0.66; 'quality': 0.69; 'opinions': 0.72; '(yes,': 0.84; '*really*': 0.84; '2.7.': 0.84; 'awhile': 0.84; 'is)': 0.84; 'received:fios.verizon.net': 0.84; 'discovering': 0.91; 'good,': 0.91; 'subject:Are': 0.93; 'anymore,': 0.95
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Terry Reedy <tjreedy@udel.edu>
Subject Re: Are ABCs an anti-pattern?
Date Tue, 02 Oct 2012 14:55:54 -0400
References <506AF8C9.8060406@gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host pool-173-75-251-66.phlapa.fios.verizon.net
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120824 Thunderbird/15.0
In-Reply-To <506AF8C9.8060406@gmail.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1741.1349204257.27098.python-list@python.org> (permalink)
Lines 37
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1349204257 news.xs4all.nl 6977 [2001:888:2000:d::a6]:36124
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:30652

Show key headers only | View raw


On 10/2/2012 10:23 AM, Demian Brecht wrote:
> I don't use them anymore, but I'm curious about others opinions on this
> list...
>
> The more time I spend in Python, discovering what "Pythonic" code is and
> such, it seems that I throw away much in terms of academic learnings as
> far as "OOP correctness" goes. In doing so, I find that, in general,
> overall LOC (yes, I'm aware that this is a poor metric to judge anything
> on), readability and overall quality of code seems to go up. Yes, you
> give the user much more rope to hang themselves with making the general
> assumption that the user knows what they're doing, but we're all
> consenting adults here after all, right? ;)
>
> As an example, I initially had an OAuth 2.0 client library that was
> roughly 450 LOC (using ABCs, adapter patterns for the various flows,
> etc). Dropping this for a more "Pythonic" (at least, what my
> interpretation of Pythonic code is) brought the entire library down to
> 55 LOC. Having said that, the decline in LOC and overall grok-ability
> wasn't entirely due to moving away from ABCs and dropping the use of
> adapters, but it did have quite a bit to do with it).
>
> As such, I see ABCs as somewhat of an anti-pattern in the Python world.
> The concept is obviously essential in non-duck-typed language using
> strict OOP, but does it *really* belong in Python?

ABCs were added (fairly recently) in 3.0 for the reasons given in
http://python.org/dev/peps/pep-3119/
It was expected that it would take awhile for them to see good, pythonic 
uses. We obviously did okay without them up to 2.7.

They are partly informational, partly meant to help duck typing. I don't 
think they are used much in the stdlib (except to register classes) and 
I have not used them myself.

-- 
Terry Jan Reedy

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


Thread

Re: Are ABCs an anti-pattern? Terry Reedy <tjreedy@udel.edu> - 2012-10-02 14:55 -0400

csiph-web