In python, what does len(list) do?
- by nsharish
My doubt is that if the len(list) calculates the length of the list everytime it is called or it returns the value of the builtin counter.I have a context where i need to check the length of list everytime in a loop, likelistData = []
for value in ioread():
if len(listData)=25:
processlistdata()
clearlistdata()
listData.append(value)
Should I check len(listData) every iteration, or can I have a counter for the length of the list.