[issue45092] Make set ordered like dict

2021-09-02 Thread Michael Rans
New submission from Michael Rans : Now that dict is ordered, it is a bit confusing that set isn't as well. I suggest making set ordered too. -- messages: 400974 nosy: mcarans priority: normal severity: normal status: open title: Make set ordered like dict type: behavior versions: Pytho

[issue45093] Add method to compare dicts accounting for order

2021-09-02 Thread Michael Rans
New submission from Michael Rans : I suggest adding a method that allows comparing dicts taking into account the order - an ordered compare (since == does not do that). (Also for my other issue (https://bugs.python.org/issue45092) where I suggested that set be ordered to reduce confusion, the

[issue45093] Add method to compare dicts accounting for order

2021-09-02 Thread Michael Rans
Change by Michael Rans : -- type: -> behavior ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.p

[issue45092] Make set ordered like dict

2021-09-02 Thread Steven D'Aprano
Steven D'Aprano added the comment: See #42368 Also this thread: https://mail.python.org/pipermail/python-dev/2019-February/156466.html -- nosy: +steven.daprano type: behavior -> enhancement ___ Python tracker

[issue45093] Add method to compare dicts accounting for order

2021-09-02 Thread Steven D'Aprano
Steven D'Aprano added the comment: What is your use-case for having dicts that differ only in order compare unequal? I can't think of any reason why I would want such a comparison, but if I did, it's a trivial one-liner: d1 == d2 and all(k1 == k2 for k1, k2 in zip(d1, d2)) -- n

[issue45093] Add method to compare dicts accounting for order

2021-09-02 Thread Michael Rans
Michael Rans added the comment: My use case is in testing. Currently I use an OrderedDict, but since dict introduced ordering in 3.7, I was considering switching. For my test, I need to check that the dictionary is the same both in content and order. I can indeed use your one liner, but just

[issue45092] Make set ordered like dict

2021-09-02 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> Make set ordered ___ Python tracker ___ ___

[issue45081] dataclasses that inherit from Protocol subclasses have wrong __init__

2021-09-02 Thread miss-islington
miss-islington added the comment: New changeset 79e9f5a58427c73dc546cb571819d50defe2e14f by Miss Islington (bot) in branch '3.10': bpo-45081: Fix __init__ method generation when inheriting from Protocol (GH-28121) https://github.com/python/cpython/commit/79e9f5a58427c73dc546cb571819d50defe2e

[issue45093] Add method to compare dicts accounting for order

2021-09-02 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: For tests it can be more convenient to use list(d1.items()) == list(d2.items()) because it can produce better report on failure. You can add a simple helper function if you use it multiple times in tests. -- nosy: +serhiy.storchaka __

[issue45081] dataclasses that inherit from Protocol subclasses have wrong __init__

2021-09-02 Thread Łukasz Langa
Change by Łukasz Langa : -- versions: +Python 3.10, Python 3.11 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

<    1   2