[Python-ideas] Boolean parameters guidelines

Ethan Furman ethan at stoneleaf.us
Wed May 11 17:57:30 EDT 2016


On 05/11/2016 02:40 PM, Zachary Ware wrote:
> On Wed, May 11, 2016 at 3:36 PM, Ian Kelly wrote:
>> On Wed, May 11, 2016 at 12:51 PM, Mark Dickinson wrote:
>>> On Wed, May 11, 2016 at 5:10 PM, Sven R. Kunze  wrote:

>>>> Additionally, it seems like this could be said for other primitive datatypes
>>>> as well:
>>>>
>>>>--> sleep(100)  # minutes?
>>>
>>> Don't be silly. Why on earth would that argument represent minutes?
>>>
>>> It's days, for consistency with `timedelta(100)`.
>>
>> Still best to be explicit:
>>
>>--> sleep(timedelta(100))
>>
>> It would be awesome if that actually worked.
>
> You just weren't explicit enough:
>
>     --> sleep(timedelta(100).total_seconds())
>
> This is drifting pretty far from the topic at hand, though.

There was a topic at hand?

Oh, yeah, keyword arguments!

Actually, it's very apropos:  each of those examples would have been 
either obviously correct or obviously wrong if the parameter names had 
been used.

--
~Ethan~



More information about the Python-ideas mailing list