3 ms·
I really don't like the idea of a function forcing me to use it a specific way. It's the same reason I don't like type checking at runtime. I can see the bene
by dec0dedab0de 5y ago
I really don't like the idea of a function forcing me to use it a specific way. It's the same reason I don't like type checking at runtime.
I can see the benefit of forcing junior members of my team to use keyword arguments, but I would be so annoyed if a library author did it to me.
Unless there is a technical reason, your callables should just work the same way as all the others.
I can't think of any reason to use positional only arguments, but keyword only arguments would be nice if I had a variable length of positional arguments that get packed, but then wanted to have an optional argument to change some behavior. But even then it's normally better to just have the caller send an iterable.
- DangitBobby 5y agoAgreed. This makes some patterns unnecessarily difficult for little gain. I wish they hadn't added these parameter restrictions to the language.