Steven Bethard wrote:
> On Mon, Apr 13, 2009 at 1:14 PM, Mart Sõmermaa <mrts.py...@gmail.com> wrote:
>> A default behaviour should be found that works according to most
>> user's expectations so that they don't need to use the positional
>> arguments generally.
> 
> I believe the usual Python approach here is to have two variants of
> the function, add_query_params and add_query_params_no_dups (or
> whatever you want to name them). That way the flag parameter is
> "named" right in the function name.

Yep - Guido has pointed out in a few different API design discussions
that a boolean flag that is almost always set to a literal True or False
is a good sign that there are two functions involved rather than just
one. There are exceptions to that guideline (e.g. the reverse argument
for sorted and list.sort), but they aren't common, and even when they do
crop up, making them keyword-only arguments is strongly recommended.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncogh...@gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to