KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
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 check the length of a list every time through a loop, like: listData = [] for value in ioread(): if len(listData)>=25: processlistdata() clearlistdata() listData.append(value) Should I check len(listData) on every iteration, or should I have a counter for the length of the list?
Tags (comma-separated)
Save Edits
Cancel