Hi
Here's a similar example
$ python3
> Python 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> from collections import Counter
> >>> cnt = Counter # Oops!
> >>> cnt.update('abcde')
> >>> cnt
> <class 'collections.Counter'>
>
This is what happens without the typo.
>>> cnt = Counter()
> >>> cnt.update('abcde')
> >>> cnt
> Counter({'a': 1, 'b': 1, 'c': 1, 'd': 1, 'e': 1})
>
Here's a link to the source for Counter.update:
https://github.com/python/cpython/blob/3.11/Lib/collections/__init__.py#L658-L690
--
Jonathan
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/UXD6EAUTFGLHPALMHVJQ53A5SG3DFRAF/
Code of Conduct: http://python.org/psf/codeofconduct/