News for hackers. Stuff that matters.
Re:Where do argc and argv come from? by wwright on Monday August 10, 2020 @04:26PM (#24113605)
Modern Python lets you explicitly opt out of this by putting “/“ in your argument list iirc correctly:

    def only_positional(a, b, /):
        Pass
Similarly, you can prevent keyword args from being called as positional (which has the inverse problem of breaking client code by changing the order of keyword arguments):

    def only_keyword(*, foo, bar):
        pass
Re:Where do argc and argv come from? by dralley on Monday August 10, 2020 @11:01PM (#24116758)
The first feature pretty much only exists to make interop with C apis less error prone. It's not really something that should be used in idiomatic Python
Re:Where do argc and argv come from? by dragonwriter on Monday August 10, 2020 @11:09PM (#24116797)
> The first feature pretty much only exists to make interop with C apis less error prone.

It makes it so that certain built-ins and native APIs can be properly typed, sure, but positional/keyword interchangeability is arguably a violation of the Zen, too.

Re:Where do argc and argv come from? by wwright on Tuesday August 11, 2020 @05:44PM (#24126384)
I disagree for the exact reason the thread here started: it’s part of your public API. If you don’t want keyword arguments in your public API contract, you absolutely should omit them from the contract.