Tom Ritchford
Jun 21, 2024

--

First, any good linter will detect this issue and complain about it.

Second, that is probably the wrong type definition for the function.

If you are intending to change it, use typing.MutableSequence; if you aren't, use typing.Sequence. This way you can pass in other sequences that aren’t a list but will still do the job.

Have claps for pointing out this famous trap, which everyone should know!!

--

--