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 -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/UXD6EAUTFGLHPALMHVJQ53A5SG3DFRAF/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to