Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!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.033 X-Spam-Evidence: '*H*': 0.93; '*S*': 0.00; 'subject:Function': 0.09; 'try:': 0.09; 'finds': 0.16; 'reraised.': 0.16; 'wrote:': 0.18; 'code,': 0.22; 'gets': 0.27; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'checked': 0.32; 'problem': 0.35; 'subject: (': 0.35; 'except': 0.35; 'received:google.com': 0.35; 'to:addr:python-list': 0.38; 'structure': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=biN4hYC1esQ7w5tuCu31/wJVjqyN1kp6XSAlXmjQ4zA=; b=tzorGqxIf84ZLNJmNF4Vf0L7vALgNFdjQL8sfjXzQoD8fS6IgFZ4aVrW2McsDiFlMF RCyoR6WRHc7wI6/RghXA4fu2819PJMeNDgdCeASKw9HGHR7NDv7e3qkm1Y0Sf7C/ZVTc l0w15lKXPviQhtMwM+KVIpTWwcUA7JkOyJpvkbaQkCi2lETGdrf7WY641ruTie201VNj u6OqMxy1NWgoRg+pg90Gil5SHYk9VtmqjOVSeHtguAdoulR/3Oy8xEN79k1JDnnudENh qUA3BxTF37pu1NHHoZfOvXc4zp5jZQwL60ob7pgs+7lM9amtFUhL8cBefqcF1KVEe2gg RWhg== X-Received: by 10.236.35.198 with SMTP id u46mr7084331yha.54.1402246879155; Sun, 08 Jun 2014 10:01:19 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <7c2fd803-616d-4daa-b570-3c5de140a1da@googlegroups.com> References: <8b96ae27-20fa-4df9-807e-c806fed983c0@googlegroups.com> <7c2fd803-616d-4daa-b570-3c5de140a1da@googlegroups.com> From: Ian Kelly Date: Sun, 8 Jun 2014 11:00:38 -0600 Subject: Re: Uniform Function Call Syntax (UFCS) To: Python Content-Type: text/plain; charset=UTF-8 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: 9 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1402246882 news.xs4all.nl 2905 [2001:888:2000:d::a6]:46700 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:72976 On Sun, Jun 8, 2014 at 2:15 AM, jongiddy wrote: > One problem with your untested code, the superclasses would need to be checked before using UFCS, so the structure is: > > try: > return super().__getattr__(attr) > except AttributeError: > # resolve using UFCS And then if UFCS finds nothing, make sure the AttributeError gets reraised.