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


Groups > comp.lang.python > #62006

Re: Type of an object: ‘obj.__class__’ versus ‘type(obj)’

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.013
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; '16,': 0.03; 'cc:addr :python-list': 0.11; 'arbitrarily': 0.16; 'cases)': 0.16; 'finney': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'pathological': 0.16; 'subject:object': 0.16; 'subject:versus': 0.16; 'wrote:': 0.18; 'not,': 0.20; 'cc:addr:python.org': 0.22; 'mon,': 0.24; 'cc:2**0': 0.24; 'header :In-Reply-To:1': 0.27; 'dec': 0.30; 'message-id:@mail.gmail.com': 0.30; 'received:google.com': 0.35; 'there': 0.35; 'should': 0.36; 'changing': 0.37; 'ben': 0.38; 'pm,': 0.38; 'expect': 0.39; 'subjectcharset:utf-8': 0.72; 'to:none': 0.92; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type:content-transfer-encoding; bh=C4KAABghnvko6quB8N+LBbgkzi5bClfTQVV4guud6pg=; b=p9fqNJZr0LTxAEkl1O/DmddA9p4NxWOrNoy+XBhkA8UA825Xvrq610afbaBh2wbzU0 MkfW2LwCe1a5ejLx9/U6YlLmKOKXjCZ8TH8PGU1Bii+xEWnx4twl/PKz7dAEFnHg3ilM pnDI8qsgeZw28R5cTTlV4Anz3kPzMqsZ83iFjDsTBexFthfOA0+OyfkYBOsVgtcX2xqN SaA1k5G3zI99q0Z/O1uaOTyhF22wY/reYJ062dYUNdIe9WiQCZ1HoZtJfzaP+ek5sARG oTYwvoLDh9Es5k2N3axO0S5Wjbe18SwB0TrS8w86CS1wqWDz69FdTZYFogqhZhROOjsd djIg==
MIME-Version 1.0
X-Received by 10.66.66.234 with SMTP id i10mr17776699pat.127.1387170555782; Sun, 15 Dec 2013 21:09:15 -0800 (PST)
In-Reply-To <7wfvptjt6e.fsf@benfinney.id.au>
References <7wk3f5k1gm.fsf@benfinney.id.au> <l8lpp4$ito$1@ger.gmane.org> <7wfvptjt6e.fsf@benfinney.id.au>
Date Mon, 16 Dec 2013 16:09:15 +1100
Subject Re: Type of an object: ‘obj.__class__’ versus ‘type(obj)’
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
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 <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>
Newsgroups comp.lang.python
Message-ID <mailman.4180.1387170945.18130.python-list@python.org> (permalink)
Lines 11
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1387170945 news.xs4all.nl 2890 [2001:888:2000:d::a6]:35368
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:62006

Show key headers only | View raw


On Mon, Dec 16, 2013 at 3:50 PM, Ben Finney <ben+python@benfinney.id.au> wrote:
> Should we expect (ignoring pathological cases) the assertion
> ‘type(obj) is obj.__class__’ to hold true? If not, under what
> circumstances would it be sensible for those to differ?

By "pathological cases", do you mean arbitrarily changing
obj.__class__, or is there some other way for them to differ?

ChrisA

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


Thread

Re: Type of an object: ‘obj.__class__’ versus ‘type(obj)’ Chris Angelico <rosuav@gmail.com> - 2013-12-16 16:09 +1100

csiph-web