3 ms·
Forcing your consumers to use a style you like is not a "win", it's a power play.
by DangitBobby 5y ago
Forcing your consumers to use a style you like is not a "win", it's a power play.
- jackblemming 5y agoThis is completely right. On top of this, most modern IDEs can show you implicit parameter names in the function call if you want. It's a feature you can toggle on or off. Don't force people to consume things how you want because you dont use local variables or have a modern IDE.
- hprotagonist 5y agoi intend it as both, and i’m aware of that fact. you call it “power play”, i call it “having an API for my libraries”; potato, potato.
- DangitBobby 5y agoYou have an API either way.
- joshuamorton 5y agoAlternatively, it's "opinionated", which is often a great selling point for libraries.
- DangitBobby 5y agoWhen it makes hard choices so you don't have to? Absolutely. This isn't a hard choice that has to be made, though. It's an arbitrary choice for style.
- Spivak 5y agoNo, it’s a contract guarantee. It says, except for the first parameter, I make no guarantee on the order of these parameters. def verb(object, **adjectives) is the pythonic way to pass an “options” dict. It doesn’t make sense as positional parameters and makes for a worse API.
- DangitBobby 5y agoHowever, allowing them to call them positionally doesn't actually change the capability of using it like an "options" dict. It makes exactly the same API minus flexibility for the caller.