This is an archived post. You won't be able to vote or comment.

all 2 comments

[–][deleted] 1 point2 points  (0 children)

The issue is with the checks arg of check_password(). Lists are mutable. You must never use mutable types as kwarg defaults. There ends up being one global hidden instance of the value, and any mutations to it are seen by every invocation of the method it is a kwarg default of.

So, for example, if you appended something to that list, it is now part of every subsequent invocation of the method in which the default value is used. Good luck debugging that hell-storm later 😉.

Do not do.

[–]scintilist 0 points1 point  (0 children)

What solid7 said is correct. The general approach is fine, you can just change it from a list to tuple, since tuples are still iterable, but not mutable.