New submission from Tomas Nordin <[email protected]>:
Hello Python bug tracker
Trying to create a dict with a top level set pair will fail, but how
will it fail?
Here comes a terminal session to reproduce the behavior. The same
command is just repeated.
----------------------------------8<----------------------------------
$ python3 -c 'd = dict({1, "one"})'
Traceback (most recent call last):
File "<string>", line 1, in <module>
TypeError: cannot convert dictionary update sequence element #0 to a sequence
# Understand, can't convert 1 to sequence.
$ python3 -c 'd = dict({1, "one"})'
Traceback (most recent call last):
File "<string>", line 1, in <module>
ValueError: dictionary update sequence element #0 has length 3; 2 is required
# Not so helpful to me, don't understand.
$ python3 -c 'd = dict({1, "one"})'
Traceback (most recent call last):
File "<string>", line 1, in <module>
TypeError: cannot convert dictionary update sequence element #0 to a sequence
# OK, thanks
$ python3 -c 'd = dict({1, "one"})'
Traceback (most recent call last):
File "<string>", line 1, in <module>
TypeError: cannot convert dictionary update sequence element #0 to a sequence
$ python3 -c 'd = dict({1, "one"})'
Traceback (most recent call last):
File "<string>", line 1, in <module>
TypeError: cannot convert dictionary update sequence element #0 to a sequence
$ python3 -c 'd = dict({1, "one"})'
Traceback (most recent call last):
File "<string>", line 1, in <module>
ValueError: dictionary update sequence element #0 has length 3; 2 is required
# Again?
---------------------------------->8----------------------------------
I searched the bug tracker on "dict typeerror valueerror" but couldn't
find something similar. What do you think about this?
$ python3 --version
Python 3.7.3
Best regards
--
Tomas
----------
components: Library (Lib)
messages: 366781
nosy: tomnor
priority: normal
severity: normal
status: open
title: Faulty dict arg gives ValueError but mostly TypeError
type: behavior
versions: Python 3.7
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue40329>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com