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


Groups > comp.lang.python > #79876

Re: What for -- for? (was A bug?)

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!lightspeed.eweka.nl!lightspeed.eweka.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <zachary.ware@gmail.com>
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; 'output': 0.05; 'importerror:': 0.07; 'subject: -- ': 0.07; 'subject:bug': 0.07; 'try:': 0.09; 'python': 0.11; 'def': 0.12; 'collections': 0.16; 'compatible.': 0.16; 'iterable': 0.16; 'sequence,': 0.16; 'subject:?)': 0.16; 'sender:addr:gmail.com': 0.17; 'wrote:': 0.18; 'import': 0.22; 'to:name:python-list@python.org': 0.22; 'header :In-Reply-To:1': 0.27; 'generally': 0.29; 'message- id:@mail.gmail.com': 0.30; 'classes': 0.35; 'except': 0.35; 'etc': 0.35; 'received:google.com': 0.35; 'list': 0.37; 'to:addr:python- list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'how': 0.40; 'range': 0.61; 'skip:n 10': 0.64; 'more': 0.64; 'discover': 0.82; '(ie': 0.84; 'abc': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:content-type; bh=TbepSp6NwPfICQFfg4tXyYvoZY4c9J5tBeRFS6KSIrk=; b=Tg5N67CCklWVeKPoUT31XT0IlcVpsNC0qbq62avYyT9ZNMejIQAy+5vx/GhpUxfaM2 6YrPiBwqpI4dBWq/46jWzVulYTVsY0gbn5hGOTIcKweqPnihG6LUZTyD9w6SM8C5hrSE aHJzS5ROq2IdTKCGUOKfnWa2B8wvfUrEcRg8Q9qaW0KBvbYhoIR/2u6Jo92Vn9YDfsc+ 1VL1Ohkh2i3cTo22yov+CCKbjH9yUtHcDGoi9B2RAywR+ZLIevEpnmixUHE64vFMAPa4 RFlZTBPJspDYSlNs/9gxR3A8z7GiPSDzA/hTKAktH0gh0tI8N8ENB/52zaudFNrVLO+S EvEg==
X-Received by 10.60.102.211 with SMTP id fq19mr6682569oeb.2.1414556212657; Tue, 28 Oct 2014 21:16:52 -0700 (PDT)
MIME-Version 1.0
Sender zachary.ware@gmail.com
In-Reply-To <94e3143a-c9ab-433d-8b3d-6ab296de14d9@googlegroups.com>
References <f491d969-7405-4017-b9c4-e1cb52a70280@googlegroups.com> <m2mof5$hvh$2@dont-email.me> <mailman.15248.1414459811.18130.python-list@python.org> <m2pinn$hum$2@dont-email.me> <94e3143a-c9ab-433d-8b3d-6ab296de14d9@googlegroups.com>
From Zachary Ware <zachary.ware+pylist@gmail.com>
Date Tue, 28 Oct 2014 23:16:32 -0500
X-Google-Sender-Auth 1E61GqTpXxW1GFhkRfCpOM1J4Sk
Subject Re: What for -- for? (was A bug?)
To "python-list@python.org" <python-list@python.org>
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 <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.15281.1414556215.18130.python-list@python.org> (permalink)
Lines 18
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1414556215 news.xs4all.nl 2874 [2001:888:2000:d::a6]:43987
X-Complaints-To abuse@xs4all.nl
X-Received-Bytes 3868
X-Received-Body-CRC 2484169008
Xref csiph.com comp.lang.python:79876

Show key headers only | View raw


On Tue, Oct 28, 2014 at 10:22 PM, Rustom Mody <rustompmody@gmail.com> wrote:
> How to see that list and range are both sequences?
> Or more generally how to to introspectively discover (ie not by reading docs!!)
> the abstract base classes -- eg sequence, iterable etc -- for an arbitrary
> object?

# Python 2/3 compatible.  Combine with pprint for nice interactive output
try:
    from collections import abc
except ImportError:
    import collections as abc

def get_abc_map(cls):
   return {n: issubclass(cls, getattr(abc, n)) for n in dir(abc) if
n[0].isupper()}

-- 
Zach

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


Thread

A bug? "umatrp@gmail.com" <trsexgl@gmail.com> - 2014-10-27 09:01 -0700
  Re: A bug? Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2014-10-27 17:17 +0100
  Re: A bug? Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-27 10:26 -0600
  Re: A bug? Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-28 00:36 +0000
    Re: A bug? Rustom Mody <rustompmody@gmail.com> - 2014-10-27 18:12 -0700
      Re: A bug? Chris Angelico <rosuav@gmail.com> - 2014-10-28 12:25 +1100
        Re: A bug? Rustom Mody <rustompmody@gmail.com> - 2014-10-27 19:13 -0700
    Re: A bug? Joshua Landau <joshua@landau.ws> - 2014-10-28 01:29 +0000
      Re: A bug? Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-29 02:17 +0000
        What for -- for?  (was A bug?) Rustom Mody <rustompmody@gmail.com> - 2014-10-28 20:22 -0700
          Re: What for -- for? (was A bug?) Zachary Ware <zachary.ware+pylist@gmail.com> - 2014-10-28 23:16 -0500
          Re: What for -- for? (was A bug?) Zachary Ware <zachary.ware+pylist@gmail.com> - 2014-10-28 23:23 -0500
            Re: What for -- for? (was A bug?) Rustom Mody <rustompmody@gmail.com> - 2014-10-28 21:40 -0700
              Re: What for -- for? (was A bug?) Zachary Ware <zachary.ware+pylist@gmail.com> - 2014-10-28 23:59 -0500
                Re: What for -- for? (was A bug?) Rustom Mody <rustompmody@gmail.com> - 2014-10-28 22:15 -0700
                Re: What for -- for? (was A bug?) Zachary Ware <zachary.ware+pylist@gmail.com> - 2014-10-29 00:39 -0500
                Re: What for -- for? (was A bug?) Rustom Mody <rustompmody@gmail.com> - 2014-10-28 23:11 -0700
                Re: What for -- for? (was A bug?) Zachary Ware <zachary.ware+pylist@gmail.com> - 2014-10-29 01:18 -0500
                Finding way around ABCs (was What for -- for? (was A bug?)) Rustom Mody <rustompmody@gmail.com> - 2014-10-30 10:01 -0700
                Re: Finding way around ABCs (was What for -- for? (was A bug?)) Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-30 11:09 -0600
                Re: Finding way around ABCs (was What for -- for? (was A bug?)) Rustom Mody <rustompmody@gmail.com> - 2014-10-30 10:16 -0700
                Re: Finding way around ABCs (was What for -- for? (was A bug?)) Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-30 11:11 -0600
          Re: What for -- for? (was A bug?) Ben Finney <ben+python@benfinney.id.au> - 2014-10-29 16:27 +1100
          Re: What for -- for? (was A bug?) Zachary Ware <zachary.ware+pylist@gmail.com> - 2014-10-29 00:42 -0500
            Re: What for -- for? (was A bug?) Rustom Mody <rustompmody@gmail.com> - 2014-10-28 22:57 -0700
          Re: What for -- for? (was A bug?) Ben Finney <ben+python@benfinney.id.au> - 2014-10-29 17:02 +1100
          Re: What for -- for? (was A bug?) Joshua Landau <joshua@landau.ws> - 2014-10-30 17:21 +0000
            Re: What for -- for? (was A bug?) Rustom Mody <rustompmody@gmail.com> - 2014-10-30 10:41 -0700

csiph-web