Does len(list)
calculate the length of the list every time it is called, or does it return the value of the built-in counter?
I have a context where I need to c
You should probably be aware, if you're worried about this operation's performance, that "lists" in Python are really dynamic arrays. That is, they're not implemented as linked lists, which you generally have to "walk" to compute a length for (unless stored in a header).
Since they already need to store "bookkeeping" information to handle memory allocation, the length is stored too.