[issue5405] There is no way of determining which ABCs a class is registered against

2020-11-16 Thread Irit Katriel


Change by Irit Katriel :


--
type: behavior -> enhancement
versions: +Python 3.10, Python 3.9 -Python 2.7, Python 3.1

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5405] There is no way of determining which ABCs a class is registered against

2011-05-23 Thread Nick Coghlan

Nick Coghlan  added the comment:

This topic came up again on python-ideas:
http://mail.python.org/pipermail/python-ideas/2011-May/010293.html

--
stage:  -> needs patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5405] There is no way of determining which ABCs a class is registered against

2009-03-02 Thread Nick Coghlan

Nick Coghlan  added the comment:

While a complete solution isn't possible, at least supporting querying
of explicit registrations would be an improvement over the status quo
(since an implicit registration can always be turned into an explicit
one, but a registration can't always be turned into inheritance).

For this to work in practice, I believe a PEP would be needed to add a
"subscribe" method to ABCMeta instances - this method would accept two
callbacks, one that was called whenever register() was invoked, and a
second when unregister() was invoked. Generic functions which add ABCs
registered could then subscribe to them and update their type caches
appropriately.

--
nosy: +ncoghlan

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5405] There is no way of determining which ABCs a class is registered against

2009-03-02 Thread Paul Moore

Paul Moore  added the comment:

Good point! So a documentation patch, to the effect that there is no way
of determining which ABCs a given class is an instance of, would be an
appropriate resolution, I guess.

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5405] There is no way of determining which ABCs a class is registered against

2009-03-02 Thread Armin Ronacher

Armin Ronacher  added the comment:

I suppose it would be a good idea to fix part of that problem in Sphinx
(and probably also in pydoc) by adding something like ":implements:
MutableMapping" in the docstring.

So that this is explicitly added to the docstring and conforming tools
can use this documentation hints.

Similar things are currently implemented in Sphinx for ":param:"
":return:" etc.

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5405] There is no way of determining which ABCs a class is registered against

2009-03-02 Thread Armin Ronacher

Armin Ronacher  added the comment:

I don't think this can be solved.  Not only do registered classes not
show up (which could be fixed by providing something like
inspect.getfakemro) but ABCs can also perform duck-type checks.

For example a class with an __iter__ method is an instance of
collections.Iterable or how it's called thanks to the __subclasscheck__
magic method.

--
nosy: +aronacher

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5405] There is no way of determining which ABCs a class is registered against

2009-03-02 Thread Paul Moore

New submission from Paul Moore :

There is no way to determine the list of classes for which issubclass(C,
x) is true. The MRO of the class is fine for normal inheritance, but for
ABCs it is possible to register classes which don't inherit from the
ABC, so that you have a situation where issubclass (C, MyABC) can be
true without MyABC being in C.__mro__:

>>> import abc
>>> class MyABC(object):
... __metaclass__ = abc.ABCMeta
...
>>> class C(object):
... pass
...
>>> MyABC.register(C)
>>> issubclass(C, MyABC)
True
>>> C.__mro__
(, )
>>>

This means that ABCs do not play well with the type of introspection
required to implement such features as generic functions - namely
enumeration of the (logical) superclasses of a class.

--
components: Interpreter Core
messages: 83011
nosy: pmoore
priority: normal
severity: normal
status: open
title: There is no way of determining which ABCs a class is registered against
type: behavior
versions: Python 2.7, Python 3.1

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com