> I don't quite understand. In the case where the function is expecting a list, why would you want to execute the logic for "empty list" on an empty tuple?
Because for most functions that's not a relevant or useful distinction, in Python a tuple is an immutable list, both are sequences.
By mis-handling empty tuples you're just unnecessarily constraining the caller. Not only that, but you might also create an inconsistency which is hard for the caller to notice if your function only fucks up on empty collections.
Because for most functions that's not a relevant or useful distinction, in Python a tuple is an immutable list, both are sequences.
By mis-handling empty tuples you're just unnecessarily constraining the caller. Not only that, but you might also create an inconsistency which is hard for the caller to notice if your function only fucks up on empty collections.