Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

That link shows that yes, "_count_elements" is implemented in Python, but right after it pulls in the C version if available (which it presumably is in CPython):

   try:                                    # Load C helper function if available
       from _collections import _count_elements
   except ImportError:
       pass
Here is the C version (with a comment a little way down describing the "fast path advantages": https://github.com/python/cpython/blob/93d33b47af70ede473f82...


Well spotted, thanks.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: