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


Groups > comp.lang.python > #79959

Re: Finding way around ABCs (was What for -- for? (was A bug?))

References (10 earlier) <mailman.15285.1414561194.18130.python-list@python.org> <525eb5e7-c221-4336-8c9a-aafb4c545f51@googlegroups.com> <mailman.15288.1414563555.18130.python-list@python.org> <b2d79374-d0fd-4a47-ba3d-7d1b476d1526@googlegroups.com> <CALwzidmNm-SB8sB1u3Mi9T1E3MqP25rK3b5dwX3jjA59zqSBjg@mail.gmail.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date 2014-10-30 11:11 -0600
Subject Re: Finding way around ABCs (was What for -- for? (was A bug?))
Newsgroups comp.lang.python
Message-ID <mailman.15327.1414689131.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Thu, Oct 30, 2014 at 11:09 AM, Ian Kelly <ian.g.kelly@gmail.com> wrote:
> On Thu, Oct 30, 2014 at 11:01 AM, Rustom Mody <rustompmody@gmail.com> wrote:
>> On Wednesday, October 29, 2014 11:49:27 AM UTC+5:30, Zachary Ware wrote:
>>> On Wed, Oct 29, 2014 at 1:11 AM, Rustom Mody wrote:
>>> > On Wednesday, October 29, 2014 11:10:06 AM UTC+5:30, Zachary Ware wrote:
>>> >> Of course, that's 3 (progressively shorter) loops to get the names of
>>> >> the ABCs of a class compared to 1 (fairly short in the first place)
>>> >> loop for a map of relationships to all available ABCs, but optimizing
>>> >> such a toy as this would just be an exercise in futility :)
>>> >
>>> > Not so.
>>> >
>>> > The charm of introspection is that the introspection
>>> > itself can be introspected.
>>> > For that to be convincing there needs to be a good combo
>>> > of clarity and succinctness.  In particular why not reduce
>>> > the two functions to one?
>>> >
>>> > def get_abc_names(cls):
>>> >     return [abc.__name__ for abc in abcs if issubclass(cls,abc)]
>>>
>>> Well, it depends on what you actually want, the spec has been a bit fuzzy ;)
>>
>> Thanks for this much -- its helpful.
>> Regarding ABCs -- is there a central documentation for them:
>>
>> "What exactly is a sequence or iterable or etc protocol?"
>>
>> This information seems to be strewn all over the place but systematically.
>
> Maybe the glossary?

Also the documentation for the collections.abc and numbers modules:

https://docs.python.org/3/library/collections.abc.html
https://docs.python.org/3/library/numbers.html

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