Ignore mutable-argument-default (B006)
in .pyi
stubs
#14026
Labels
accepted
Ready for implementation
help wanted
Contributions especially welcome
rule
Implementing or modifying a lint rule
Mutable argument defaults can only be a problem at runtime. But at the moment,
B006
will also be reported in.pyi
stub files, even though it is certain that mutations can never occur there.For example, consider the following function in
scipy-stubs/stats/_mstats_basic.pyi:578
:For the
prob
parameter the following error is reported:I think that "mutable" defaults should be allowed in cases like these. Having explicit parameter defaults that match the runtime can be seen as a form of documentation. This is especially useful when the runtime sources aren't available, which is quite common in this
scipy-stubs
case.The text was updated successfully, but these errors were encountered: