Re: [Python-ideas] parameter omit

"Aaron Brady" <castironpi@comcast.net> wrote:
Also, any follow-up on this? (I posted at top.)
I don't like it. The current calling semantics are sufficient for the vast majority of cases. For those cases that are not covered by the current calling semantics, there is a PEP for allowing variations in optional arguments, keyword arguments, etc. I can't remember the number, but the PEP index has it. As for signaling "use the default", there is a standard method: omit the argument. If you want the argument to always be required to be a keyword argument, you can use... def foo(arg1, **kwargs): arg2 = kwargs.get('arg2', 1.2325) arg3 = kwargs.get('arg3', 'hello') ... - Josiah

I don't like it. Cobol is sufficient. Python is very cool.
Library functions have many parameters, and huge if statements are hard to read. My solution costs only a single built-in object, not even a keyword or syntax modification. Your solution takes a three-line function definition. Compare to mine: def foo(arg1, argFoo=1.2325, argBree='hello'): ... Specific and concise. Clearly better, by all measures I read.

Aaron Brady wrote:
With PEP 3102 in place you don't even need the **kwargs: http://www.python.org/dev/peps/pep-3102/ -- Talin

I don't like it. Cobol is sufficient. Python is very cool.
Library functions have many parameters, and huge if statements are hard to read. My solution costs only a single built-in object, not even a keyword or syntax modification. Your solution takes a three-line function definition. Compare to mine: def foo(arg1, argFoo=1.2325, argBree='hello'): ... Specific and concise. Clearly better, by all measures I read.

Aaron Brady wrote:
With PEP 3102 in place you don't even need the **kwargs: http://www.python.org/dev/peps/pep-3102/ -- Talin
participants (3)
-
Aaron Brady
-
Josiah Carlson
-
Talin