Sobes.tech
Junior — Senior

Код‑ревью: выявление дефектов в функции get_first_matching_object

livecode

Task condition

Perform a review of the provided function code. Identify and list all logical and technical errors. The function is intended to return the first element from the given list that satisfies the specified predicate.


def get_first_matching_object(predicate, objects=[]):
    matching_objects = [obj for obj in objects if predicate(obj)]
    if matching_objects:
        return matching_objects[0]
    else:
        return None