-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 08/19/2010 12:55 PM, Jason Rist wrote: > On 08/19/2010 10:28 AM, Jason Dobies wrote: >> 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. >> > It knows... > _______________________________________________ > Pulp-list mailing list > [email protected] > https://www.redhat.com/mailman/listinfo/pulp-list > > _______________________________________________ > Pulp-list mailing list > [email protected] > https://www.redhat.com/mailman/listinfo/pulp-list
Something else I keep seeing in the code is: if foo == None: It's better to just use object reference comparison rather than equality when checking for none: if foo is None: - -- 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/ iQEcBAEBAgAGBQJMbWHnAAoJEOMmcTqOSQHC3fwH/0i6u7V2noAWrT0TuPigUTsp EhAoEUql0LvorjvzPiCZZRmdv++J3yCVz270tdNHC26PVPJ4GHUi5cARjyb2GwQt zQZ4Y6KVeNzTCuZzDMJ3PDP954Qh2VeH1w7gk2AZdYBOi7hPa94F+EoDlBVMNXpj VXw+i+pEvw2jujwiT0gq/StBtstqhip+u3dyvHtmt/1CCssa5LTAyEoagdruYZkl 2ejPYiHXO1Bf48yCYZK5lqZBHfHLv7SwzZ/2XHQJBAwSpxoQgTw+irOTlrhorve3 fOTaUnxq6zH+KPeOrz8foKiS6yk8Rn3KwS+jgRjTvhxiJu9qDhRgq/P/gzD5eGA= =pkOv -----END PGP SIGNATURE----- _______________________________________________ Pulp-list mailing list [email protected] https://www.redhat.com/mailman/listinfo/pulp-list
