[Python-ideas] Improve ABCs _dump_registry() readability

2017-12-30 Thread Yahya Abou 'Imran via Python-ideas
In python 2.7, ABCs's caches and registries are sets. But in python 3.6 they are WeakSet. In consequence, the output of _dump_registry() is almost useless: >>> from collections import abc >>> abc.Iterator._dump_registry() Class: collections.abc.Iterator Inv.counter: 40 _abc_cache:

Re: [Python-ideas] a set of enum.Enum values rather than the construction of bit-sets as the "norm"?

2017-12-30 Thread Guido van Rossum
I should probably clarify that for this to work, Foo must derive from enum.Flags. See https://docs.python.org/3/library/enum.html#flag. (Or enum.IntFlag, https://docs.python.org/3/library/enum.html#intflag.) Note that when using Flag, you can name the "zero" value (Color.BLACK in the 3rd

Re: [Python-ideas] a set of enum.Enum values rather than the construction of bit-sets as the "norm"?

2017-12-30 Thread Guido van Rossum
On Sat, Dec 30, 2017 at 8:50 PM, Franklin? Lee < leewangzhong+pyt...@gmail.com> wrote: > > Paddy might want something like this: > - For existing APIs which take int or IntFlag flags, allow them to > also take a set (or perhaps any collection) of flags. > - In new APIs, take sets of Enum flags,

Re: [Python-ideas] a set of enum.Enum values rather than the construction of bit-sets as the "norm"?

2017-12-30 Thread Franklin? Lee
On Fri, Dec 29, 2017 at 11:25 PM, Steven D'Aprano wrote: > On Sat, Dec 30, 2017 at 02:56:46AM +1100, Chris Angelico wrote: >> On Sat, Dec 30, 2017 at 2:38 AM, Steven D'Aprano wrote: >> > The lack of support for the `in` operator is a major difference,

Re: [Python-ideas] Change the __repr__ of the `MappingView`s

2017-12-30 Thread Guido van Rossum
You're right that there's some inconsistency here. But I don't think it's worth fixing given that the fix would introduce another inconsistency (which you pointed out) and would also risk breaking backwards compatibility. I think this ship has sailed. On Sat, Dec 30, 2017 at 5:18 PM, Yahya Abou

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

2017-12-30 Thread Yahya Abou 'Imran via Python-ideas
Here is another version showing all that inherit from Container, Sized and Iterable. I got rid of ABCMeta, since it's not the prupose of the documentation of that page. I left the parenthesis and the end of the methods names though...

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

2017-12-30 Thread Yahya Abou 'Imran via Python-ideas
> A. Width restrictions suggest making the async branches a separate diagram. I was thinking about it... Maybe Hashable and Callable could also be removed, since they are standalone ABCs. And they're not directly linked with the concept of Collection anyway. > B. Be consistent on placement of

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

2017-12-30 Thread Yahya Abou 'Imran via Python-ideas
> 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

[Python-ideas] Change the __repr__ of the `MappingView`s

2017-12-30 Thread Yahya Abou 'Imran via Python-ideas
=== This proposition is purely aesthetic === At this time, the __repr__ of the mapping views is showing the whole mapping: >>> from collections.abc import ValuesView, KeysView, ItemsView >>> d = {3: 'three', 4: 'four'} >>> KeysView(d) KeysView({3: 'three', 4: 'four'}) >>> ValuesView(d)

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

2017-12-30 Thread pylang
+1 on adding these diagrams to the docs. It's great to visualize where the special methods are implemented. On Sat, Dec 30, 2017 at 4:17 PM, Terry Reedy wrote: > On 12/30/2017 11:11 AM, Yahya Abou 'Imran via Python-ideas wrote: > >> We can find very usefull class diagramm to

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

2017-12-30 Thread Stephan Houben
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