> > I counted commas. I came up with the wrong number. Simple. > > For what it's worth, I don't like the keyword-only marker or the > proposed positional-only marker for exactly the same reason. >
There's also potentially trailing commas to confuse you further :P I'm not a big fan of the keyword argument only syntax either, but that ship has sailed long ago, so now I think we should consider it Pythonic and judge future suggestions accordingly. I do like the feature of keyword only and understand the tradeoffs made to make the syntax work, so I'm quite happy overall. > I disagree. Keyword arguments are a fine and good thing, but they are > best used for optional arguments IMHO. Verbosity for the sake of > verbosity is not a good thing. > > Hmm.. it seems to me like there are some other caveats to your position here. Like "no functions with more than two arguments!" or similar? Personally I think readability suffers greatly already at two arguments if none of the parameters are named. Sometimes you can sort of fix the readability with function names like do_something_with_a_foo_and_bar(foo, bar), but that is usually more ugly than just using keyword arguments. > >>>> I disagree that f(*, page) is more readable than an explicit named > >>>> keyword argument f(page=page). > >>>> > >>> > >>> People prefer f(page) today. For some reason. That might refute your > >>> statement or not, depending on why they do it. > >> > >> Evidence? > >> > > > > Run my analysis tool. Check the numbers. It's certainly true at work, and > > it's true for Django for example. > > OK, then your assertion didn't mean what I thought it means, and I'm > very confused about what it does mean. Could you try that again? > Functions in real code have > 2 arguments. Often when reading the code the only way to know what those arguments are is by reading the names of the parameters on the way in, because it's positional arguments. But those aren't checked. To me it's similar to bracing for indent: you're telling the human one thing and the machine something else and no one is checking that those two are in sync. I have seen beginners try: def foo(b, a): pass a = 1 b = 2 foo(a, b) and then be confused because a and b are flipped. I have no idea if any of that made more sense :P Email is hard. / Anders
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/