New submission from Gregory P. Smith <g...@krypto.org>:
Python 3.9.7 (default, Sep 24 2021, 09:43:00) [GCC 10.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> dict(a=3,b=5).keys() dict_keys(['a', 'b']) >>> dict(a=3,b=5).keys() - 'a' {'b'} >>> dict(a=3,b=5).keys() - 'ab' set() >>> set(('a', 'b')) {'b', 'a'} >>> set(('a', 'b')) - 'ab' Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unsupported operand type(s) for -: 'set' and 'str' >>> set(('a', 'b')).difference('ab') set() basically it looks like the keys view treats - as .difference() whereas set() avoids bugs in its operators by requiring both to be sets. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue45780> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com