Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: 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; 'python,': 0.02; '(at': 0.03; 'patterns': 0.04; '(using': 0.07; 'python': 0.09; 'etc).': 0.09; 'list...': 0.09; 'oop,': 0.09; 'throw': 0.09; 'url:github': 0.09; 'language': 0.14; 'library': 0.15; 'essential': 0.15; 'adapter': 0.16; 'doing,': 0.16; 'dropping': 0.16; 'least,': 0.16; 'pythonic': 0.16; 'such,': 0.16; 'obviously': 0.18; 'python?': 0.20; 'all,': 0.21; 'bit': 0.21; 'academic': 0.23; 'seems': 0.23; 'header:User-Agent:1': 0.26; 'skip:@ 10': 0.27; 'decline': 0.29; "i'm": 0.29; "we're": 0.30; 'knows': 0.30; 'initially': 0.30; 'up.': 0.31; 'code': 0.31; 'belong': 0.33; 'curious': 0.33; 'right?': 0.33; 'strict': 0.33; 'to:addr:python-list': 0.33; 'themselves': 0.33; 'that,': 0.34; 'received:google.com': 0.34; '2.0': 0.35; 'so,': 0.35; 'doing': 0.35; 'received:209.85.220': 0.35; 'subject:?': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'message-id:@gmail.com': 0.36; "wasn't": 0.36; 'anything': 0.36; 'client': 0.36; 'does': 0.37; 'quite': 0.37; 'received:209': 0.37; 'far': 0.37; 'to:addr:python.org': 0.39; 'subject:-': 0.40; 'header:Received:5': 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; 'is)': 0.84; 'to:name:python': 0.84; 'discovering': 0.91; 'subject:Are': 0.93; 'anymore,': 0.95 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=3ElOmZYnO1B+cLDtDETRy/5VdS5wFnh2pgSMWXMEErk=; b=k4D0LvCj+TLhHQc8qEMx6XUergM8+TwQmLQ6KLt2W8eSyixI66K3OD3C8lmNBM4VY1 9GHZbXDnQHT7aB0zsSOmEUA7FT6iTVcPhvYFfvMTw5BpBGl1asLY3yA64XrAMmth4K8E H4vV5ZMRbSLFCSECTuCEZzRdHu456REV8jdB628L0Lk0XAbLfpwUXVacw/67QZzWHhMQ SKG9nvh0xZ85kFmAGaBsO0v2wgm6vRyqMrBeb0Yh0OV65G/YtlfJFiwFOhgqCrhOGnt7 ZPMtoss/f+VjJNiRzrNvvlGp4CpvDvFtSeLaYa3hybf8kY0VZ+ez7kbWg7EoFI64GcQl QBIg== Date: Tue, 02 Oct 2012 07:23:05 -0700 From: Demian Brecht User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120912 Thunderbird/15.0.1 MIME-Version: 1.0 To: Python Subject: Are ABCs an anti-pattern? Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 28 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1349187796 news.xs4all.nl 6865 [2001:888:2000:d::a6]:40108 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:30635 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? -- Demian Brecht @demianbrecht http://demianbrecht.github.com