Junior — Senior
Finding the bottleneck in code fragment performance
livecode
Task condition
Identify where in the following code snippet a performance issue might occur. The class provided is responsible for displaying information about user files.
class Account:
def __init__(self, full_name, contact, documents):
self.full_name = full_name
self.contact = contact
self.documents = documents
def display_file_info(self, doc):
print(f"{doc.name} - {doc.size} - {doc.type} - {doc.date}")
def list_files_info(self):
for doc in self.documents:
self.display_file_info(doc)