[Python-ideas] Add an UML class diagram to the collections.abc module documentation

Yahya Abou 'Imran yahya-abou-imran at protonmail.com
Sat Dec 30 19:25:17 EST 2017

> Hi Yahya,
> I like the full.png diagram, however, I see some issues with it.
> Most seriously, the methods it lists don't match the documentation.
> E.g. if you check MappingView:
> https://docs.python.org/3/library/collections.abc.html#collections.abc.MappingView
> you see it has only a __len__ mixin method.
> The other methods in the diagram are implementation details
> and should be removed.
> Some presentation points (all IMHO of course):
> * Get rid of the empty boxes.
> * Get rid of the trailing (). Since all methods have this, it adds no info.
> * There is no visual distinction between the abstract methods
>   and the mixin methods. I'd suggest making the abstract methods italic
>   or something like that.
> Stephan

Thank you for your observations Stephan.

The reason behind that is that I genretated it from a copy of the source code, and I was sondering about getting rid of it or not... But I think you'r right: let's display only the documented part.

About the displaying of the abstract method, sadly it seems that pyreverse doesn't support it... It didn't find a way to hide the paranetesis either. I could make those changes whth a graphic tool though. Same thing with the empty box.

Whereas it's possible with plantuml. But may be I have to use a pure python tool. What's your opinions about that?

Another thing: for exemple, in the case of Collection, it asks to implement the three method __iter__, __contains__ and __sized__, but since it inherit them from Iterable, Container and Sized, they're not shown.

I think it's better to make them appear since:
1. you have to implement them to inherit from it;
2. the three methods are checked during the __subclasshook__ of this ABC to know if a class is a virtual subclass of it or not (when pass as a second argument of issubclass() for example).

I don't think it's an error in UML to re-display them since they are abstracts (it would be if they were concretes because it would mean that they were been overriden).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20171230/ee8c38a4/attachment.html>

More information about the Python-ideas mailing list