Path: csiph.com!feeder.erje.net!1.eu.feeder.erje.net!news-1.dfn.de!news.dfn.de!news.informatik.hu-berlin.de!fu-berlin.de!uni-berlin.de!not-for-mail From: Ian Kelly Newsgroups: comp.lang.python Subject: Re: Making Classes Subclassable Date: Tue, 5 Jul 2016 08:41:44 -0600 Lines: 30 Message-ID: References: <87eg79q1i0.fsf@handshake.de> <337f8071-ef4a-4ac5-867b-a5320c684730@googlegroups.com> <577b707f$0$2917$c3e8da3$76491128@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: news.uni-berlin.de Z4SmpktGUpn5pQxQbHgS/wPUgBMHGid/4g0L1I9L6jnA== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'that?': 0.05; '__name__': 0.07; 'attributes': 0.07; 'cc:addr:python-list': 0.09; 'name):': 0.09; 'def': 0.13; '(there': 0.16; '2016': 0.16; 'cc:name:python': 0.16; 'received:io': 0.16; 'received:mail-oi0-x230.google.com': 0.16; 'received:psf.io': 0.16; 'subject:Classes': 0.16; 'x()': 0.16; 'wrote:': 0.16; '>>>': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'lawrence': 0.22; 'am,': 0.23; 'header :In-Reply-To:1': 0.24; 'skip:_ 20': 0.26; 'message- id:@mail.gmail.com': 0.27; 'certain': 0.31; 'skip:s 30': 0.31; 'class': 0.33; "d'aprano": 0.33; 'int': 0.33; 'steven': 0.33; 'tue,': 0.34; 'received:google.com': 0.35; 'monday,': 0.36; 'subject:: ': 0.37; 'test': 0.39; 'jul': 0.72; 'subject:Making': 0.84; 'to:none': 0.91 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:cc :content-transfer-encoding; bh=+e++z5Ewqb3PNMekGr+sfs8bWT7GwPsl8JGwudWsYJ0=; b=ay/2+XI7Efy23YGWgb8KqeklKM7WZO9VVXHsKo3O2Y+N20SXnrS/ZqE60YzuKI7Hja fbVj/Omd7hddIPabmdtZwuQsWcYhq3baOemb98X46alGDSeiGzwsZIT9ijnjfM7moVcl RPB1QW95LdPfOOpGXCJYx5NgxX/QlsBIHKcy8ksrU5YycX0tcawgxjwqYh13VtnyiGrE +309ZjAGGDVAzIrwm7lEm220HhpNvvt29liIBHHywfW9ZFGGaGQN83u0HsvDCKclvTBQ P2U0tRBBDV8mucQsfx60a+GMa14uCktUXV+I8k99WEsQnwRNIhUMC/pNlIvydYXGzx22 2pFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:cc:content-transfer-encoding; bh=+e++z5Ewqb3PNMekGr+sfs8bWT7GwPsl8JGwudWsYJ0=; b=IdpWgTg3TrKOxRHPtJOKLbN1sunbHhP2t7VBPkBjcCUbBgHTcHO+/U5SlJweIo40Zy khrpnXoj1Yyws/D3F4CYRUwydpevlbcvlWKs7Ez0jQk0xuekN3uRE6zYOU6z1i//PhlC TiGKN46Xrb0bC6fmQ88mVWO0YtRiBZUaEJv+x/g1CHnERXIxfCxpSgw/Mh/gaF8545SY y577f3ODcz8F2MD3tJ6/8ExCDQ9DhWpGBs63TSWlujb+YS0+F/6Dw4vXoEaKbXWCU8s0 tlNORyt4SQEKeW3hAEnO8ir7qUAQXimXyxnAm/n2EZeGcKhGWj3+rRnLf8T0xlfq1rjC fayQ== X-Gm-Message-State: ALyK8tLrOy0u58x8ve/jh637P29XNNixWq2RInYvrFragKSFyotr86/KwSWQk6EmR5dASDEP97FiWRjo0Zo/hg== X-Received: by 10.157.17.147 with SMTP id v19mr9589782otf.11.1467729744090; Tue, 05 Jul 2016 07:42:24 -0700 (PDT) In-Reply-To: <577b707f$0$2917$c3e8da3$76491128@news.astraweb.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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: <87eg79q1i0.fsf@handshake.de> <337f8071-ef4a-4ac5-867b-a5320c684730@googlegroups.com> <577b707f$0$2917$c3e8da3$76491128@news.astraweb.com> Xref: csiph.com comp.lang.python:111125 On Tue, Jul 5, 2016 at 2:31 AM, Steven D'Aprano wrote: > On Monday 04 July 2016 18:34, Lawrence D=E2=80=99Oliveiro wrote: > >> On Monday, July 4, 2016 at 7:58:07 PM UTC+12, dieter wrote: >>> --> "type(obj)" or "obj.__class__" (there are small differences) >>> give you the type/class of "obj". >> >> When would it not be the same? > > > class X(object): > def __getattribute__(self, name): > if __name__ =3D=3D '__class__': > return int > return super().__getattribute__(name) Did you actually test that? py> class X(object): ... def __getattribute__(self, name): ... if __name__ =3D=3D '__class__': ... return int ... return super().__getattribute__(name) ... py> x =3D X() py> x.__class__ Certain attributes like __class__ and __dict__ are special.