[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Pulp-list] Interesting python inspection



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

PyCharm just flagged the following code with a warning (in particular
the consumerids argument)

def create(self, id, description, consumerids=[]):

Here's the warning:

"This inspection detects when a mutable value as list or dictionary is
detected in a default value for an argument. Default argument values are
evaluated only once at function definition time, which means that
modifying the default value of the argument will affect all subsequent
calls of the function. "

That's kinda cool, I never saw anything like that before.

- -- 
Jason Dobies
RHCE# 805008743336126
Freenode: jdob
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJMbVuzAAoJEOMmcTqOSQHCFU8IAJWWvapEmhGAlsFEZsC7Ogqo
ji5D9m/eGpQv0Rj7L2NtDR98MW9VGl1LQHcQiRX3R2HafRADG9/GeAyIpRR73ool
CzZbEJ1yWtS5dBKFIvT6y8y96/CBY5CvTDCYLXn1syC8FTUdRsBqIgo0dNaQd6No
YdHd8IDmhbzk/aDsQJvhphmZlXFEhInK0bUkXJa0jaPqGJGdnzv3z9ZhGvgARKOd
NtqrmwqlvHyLXVOjYWuJqJ4dGkVDUnEEnaZsZQ0F0g5wSeC8XcK1pr6U+CZr8nog
fL6asVu7gVI3TOoT43tY+epD81hPj8zDa5w9/ad3VfRotxGNALve+pWouCQAYVE=
=Bbb8
-----END PGP SIGNATURE-----


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]