On 4/17/06, Talin <[EMAIL PROTECTED]> wrote:
> def func( first, second=default, third ):
> ... what's the point of supplying a default for the second
> parameter, but not the third?
You may be wrapping an external library. (Or at least a well-known API.)
I'll grant that the second argument probably ought to have been third,
but with an existing library, it often isn't. The real choices are
def func(first, second, third):
# Everyone supplies the junk second on every call
def func(first, second=default, third=sentinel):
if third is sentinel:
raise ValueError("Need a real 'third' key")
def func_newname(first, third):
none of which are very satisfying.
That said, I'm not sure the use case is common enough to justify the confusion.
-jJ
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com