On 2/16/21 3:43 AM, Markus Armbruster wrote:
John Snow <js...@redhat.com> writes:
It does happen to be a list (as of now), but we can describe it in more
general terms with no loss in accuracy to allow tuples and other
constructs.
In the future, we can write "ifcond: Sequence[str] = ()" as a default
parameter, which we could not do with a Mutable type like a List.
Well, we could write "= []", but we shouldn't. Worth a commit message
tweak?
It would be funny to leave it in to see if anyone tries to disprove me,
and in the act of disproving me, learns for themselves why you "can't"
do that. Rite of passage for Python programming.
Jokes aside:
"which we could not do ^safely^ with a Mutable type like a List."
If that warrants further exposition by Professor Snow:
"(Unsafe due to how Python initializes defaults, see
https://docs.python-guide.org/writing/gotchas/#mutable-default-arguments)"
I leave it to your discretion.
Signed-off-by: John Snow <js...@redhat.com>
Reviewed-by: Markus Armbruster <arm...@redhat.com>
These are worth more than BTC!
--js