Andy Maier <andreas.r.ma...@gmx.de> added the comment:

I accept that the issue was closed, but wanted to document some things:

1. The dict class manages very well to detect that a string is invalid input:

>>> d = dict('abc')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: dictionary update sequence element #0 has length 1; 2 is required

2. When initialized with strings, it looses some of its dictionary methods, but 
does a quite reasonable job in pointing that out in the error message:

>>> mp = MappingProxyType('abc')
>>> mp.items()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'str' object has no attribute 'items'

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43828>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to