How to detect that a function argument is the default one

Ned Batchelder ned at nedbatchelder.com
Wed Dec 10 11:19:37 EST 2014


On 12/10/14 11:10 AM, Jean-Michel Pichavant wrote:
>      self.mass = (mass is None and radius**2) or mass

When will this idiom die?  We've had actual if-expressions for a while now:

     self.mass = radius**2 if mass is None else mass

-- 
Ned Batchelder, http://nedbatchelder.com




More information about the Python-list mailing list