2017-03-01 21:52 GMT+01:00 Terry Reedy <tjre...@udel.edu>:
> + 1 also. When people write a Python equivalent of a built-in function for
> documentation or teaching purposes, they should be able to exactly mimic the
> API.

Yeah, Serhiy said basically the same thing: it's doable, but complex
without builtin support for positional-only arguments.

I dislike subtle differences between C and Python, and positional-only
is a major difference since it has a very visible effect on the API.

After having used PHP for years, I really enjoyed Python keyword
arguments and default values. I was very happy to not have to
"reimplement" the "keyword arguments with default values" feature in
each function (*).

Basically, I would like the same thing for positional-only arguments :-)

(*) Example (found on the Internet) of PHP code pattern for keywords, enjoy ;-)

function doSomething($arguments = array()) {
    // set defaults
    $arguments = array_merge(array(
        "argument" => "default value",
    ), $arguments);

    var_dump($arguments);
}

Victor
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to