A function signature is the interface-level shape of a function: its name and the arguments callers can provide. In Python, a signature can evolve without disrupting existing callers when a new parameter receives a suitable default value. section 6.1.2 section 1.1.1
Adding an optional note
Suppose complete_task initially accepts only task. Adding note changes the interface, but defining note="" preserves the old call complete_task(task) while allowing callers to provide a note. This keeps existing code working and reduces repetitive empty-string arguments. section 6.1.2
def complete_task(task, note=""):
task.status = "completed"
task.note = note
print(f"{task.title}'s status: completed; note: {note}")
Use the updated signature to make note optional while retaining the expanded functionality. section 6.1.2
complete_task(task)
Call the function with its original argument list; the default supplies the omitted note. section 6.1.2
When designing or reviewing a signature:
- Choose parameter names that help readers understand what the function does. section 1.1.1
- Prefer defaults when the common use case has a clear automatic value. section 6.1.2
- Preserve the existing calling signature when extending a function, where practical. section 6.1.2







