Is there are good DRY fix for this painful design pattern?
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Mon Feb 26 23:51:11 EST 2018
On Mon, 26 Feb 2018 16:23:39 -0800, Rick Johnson wrote:
> On Monday, February 26, 2018 at 5:44:18 PM UTC-6, MRAB wrote: [...]
>> Before using or'd-logic, you need to know whether the value could be
>> falsey, e.g. 0.
>
> True. However. Steven failed to provide any info that might help us
> determine the types of these parameters, and as such, i was forced to
> take the liberty of assumption.
Someone held a gun to your head?
> Now, while it's quite possible someone
> could assign dwarfy-named- symbols to implicit or explicit boolean
> values, i find it highly unlikely, and totally unintuitive. But then
> again, i have my suspicions about ths thread. ;-)
You mean things like passing 0 as an int argument, or "" as a string
argument? Yeah, I see what you mean -- that would be such a weird thing
to do...
/s
--
Steve
More information about the Python-list
mailing list