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


Groups > comp.lang.python > #17902

Re: Test None for an object that does not implement ==

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.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.011
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'subject:object': 0.07; 'subject:None': 0.09; 'am,': 0.12; 'classes,': 0.13; 'received:209.85.210.174': 0.13; 'received:mail- iy0-f174.google.com': 0.13; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'shed': 0.16; 'mon,': 0.16; 'wrote:': 0.18; '>>>': 0.18; '(most': 0.21; 'subject:not': 0.21; 'dec': 0.22; 'header:In-Reply-To:1': 0.22; '(on': 0.23; 'though.': 0.23; 'traceback': 0.24; 'classes': 0.26; 'windows': 0.26; 'testing': 0.26; 'message-id:@mail.gmail.com': 0.28; 'pass': 0.29; 'class': 0.29; 'subject:Test': 0.30; 'typeerror:': 0.30; 'certainly': 0.32; "can't": 0.32; 'actually': 0.33; 'there': 0.33; 'done': 0.34; 'to:addr:python-list': 0.34; 'certain': 0.34; 'last):': 0.34; 'file': 0.36; 'shows': 0.37; 'acceptable': 0.37; 'thread': 0.37; 'but': 0.37; 'received:google.com': 0.37; 'think': 0.37; 'steven': 0.38; 'some': 0.38; 'received:209.85': 0.38; 'received:209': 0.40; 'to:addr:python.org': 0.40; 'type': 0.61; '2011': 0.61; 'types': 0.61; '26,': 0.67; '12:48': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=uFjJe9+UHp75eMbC2FXS9n+b+q946HzgswOvJ8j/xj0=; b=qqD17HKfV4LBK7TbaQPdSxAjyRg88xYkeBMhvugSik4UPtHcz48StQC5gv4FBzStLI 7CAooZWMF1xaE6eQI+EzRz3rKRts2GKbRal8VmZnT+fBNqGH5MB5EB1XUoQgzstKaN0H g8wpUgbZmQQoufyVEE5SjcHH9J7aRq7nQkJK8=
MIME-Version 1.0
In-Reply-To <4ef729aa$0$29973$c3e8da3$5496439d@news.astraweb.com>
References <0d80ce25-9e65-4216-b26c-b8ee40f989a3@q9g2000yqe.googlegroups.com> <pan.2011.12.25.09.38.07.62000@nowhere.com> <mailman.4061.1324811442.27778.python-list@python.org> <roy-5C153F.08172825122011@news.panix.com> <mailman.4066.1324820148.27778.python-list@python.org> <4ef729aa$0$29973$c3e8da3$5496439d@news.astraweb.com>
Date Mon, 26 Dec 2011 01:04:06 +1100
Subject Re: Test None for an object that does not implement ==
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
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.4072.1324821849.27778.python-list@python.org> (permalink)
Lines 23
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1324821849 news.xs4all.nl 6879 [2001:888:2000:d::a6]:34072
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:17902

Show key headers only | View raw


On Mon, Dec 26, 2011 at 12:48 AM, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> wrote:
> I can't think of any other un-subclassable classes other than NoneType.
> Which ones are you thinking of?

I don't remember, but it was mentioned in a thread a little while ago.
Experimentation shows that 'bool' is one of them, though. This may
shed some light:

>>> class Foo(type(iter)):
	pass

Traceback (most recent call last):
  File "<pyshell#103>", line 1, in <module>
    class Foo(type(iter)):
TypeError: type 'builtin_function_or_method' is not an acceptable base type

I think there are certain types that are actually not implemented as
classes, and hence cannot be subclassed. This is almost certainly an
implementation detail though; my testing was done in Py3.2 (on Windows
fwiw).

ChrisA

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


Thread

Test None for an object that does not implement == GZ <zyzhu2000@gmail.com> - 2011-12-24 23:09 -0800
  Re: Test None for an object that does not implement == Paul Rubin <no.email@nospam.invalid> - 2011-12-24 23:28 -0800
  Re: Test None for an object that does not implement == Nobody <nobody@nowhere.com> - 2011-12-25 09:38 +0000
    Re: Test None for an object that does not implement == Lie Ryan <lie.1296@gmail.com> - 2011-12-25 22:10 +1100
      Re: Test None for an object that does not implement == Roy Smith <roy@panix.com> - 2011-12-25 08:17 -0500
        Re: Test None for an object that does not implement == Chris Angelico <rosuav@gmail.com> - 2011-12-26 00:35 +1100
          Re: Test None for an object that does not implement == Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-25 13:48 +0000
            Re: Test None for an object that does not implement == Chris Angelico <rosuav@gmail.com> - 2011-12-26 01:04 +1100
            Re: Test None for an object that does not implement == Christian Heimes <lists@cheimes.de> - 2011-12-26 01:37 +0100
          Re: Test None for an object that does not implement == Roy Smith <roy@panix.com> - 2011-12-25 09:13 -0500
            Re: Test None for an object that does not implement == Chris Angelico <rosuav@gmail.com> - 2011-12-26 01:23 +1100
            Re: Test None for an object that does not implement == Lie Ryan <lie.1296@gmail.com> - 2011-12-26 04:13 +1100
    Re: Test None for an object that does not implement == Ian Kelly <ian.g.kelly@gmail.com> - 2011-12-25 19:02 -0700
    Re: Test None for an object that does not implement == Ethan Furman <ethan@stoneleaf.us> - 2011-12-25 20:26 -0800
  Re: Test None for an object that does not implement == Larry Hudson <orgnut@yahoo.com> - 2011-12-25 15:45 -0800
    Re: Test None for an object that does not implement == Devin Jeanpierre <jeanpierreda@gmail.com> - 2011-12-25 19:06 -0500
      Re: Test None for an object that does not implement == Roy Smith <roy@panix.com> - 2011-12-25 19:27 -0500
        Re: Test None for an object that does not implement == Devin Jeanpierre <jeanpierreda@gmail.com> - 2011-12-25 19:58 -0500
    Re: Test None for an object that does not implement == Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-26 00:52 +0000
  Re: Test None for an object that does not implement == Ethan Furman <ethan@stoneleaf.us> - 2011-12-25 20:27 -0800
  Re: Test None for an object that does not implement == Devin Jeanpierre <jeanpierreda@gmail.com> - 2011-12-26 00:22 -0500
    Re: Test None for an object that does not implement == Roy Smith <roy@panix.com> - 2011-12-26 08:43 -0500
  Re: Test None for an object that does not implement == Paul Rudin <paul.nospam@rudin.co.uk> - 2011-12-26 14:33 +0000
  Re: Test None for an object that does not implement == Ethan Furman <ethan@stoneleaf.us> - 2011-12-26 09:14 -0800

csiph-web