
2017-03-01 21:52 GMT+01:00 Terry Reedy <tjreedy@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