4 ms·
There is no reason to support the first or second usage. It's totally fine to always require a t-string: db.execute(t"SELECT foo FROM bar;") See? No reaso
by Timon3 1y ago
There is no reason to support the first or second usage. It's totally fine to always require a t-string:
db.execute(t"SELECT foo FROM bar;")
See? No reason to accept strings, it's absolutely fine to always error if a string is passed.
- Izkata 1y agoMy (and their) point is that's the already existing API. You're proposing a big breaking change, with how many frameworks and tutorials are built on top of that.
- Timon3 1y agoIt's not like this is the first time APIs have been improved. There are many tools (e.g. deprecation warnings & hints in editors, linter rules) that can help bridge the gap - even if t-strings are only used for new or refactored code, it's still a big improvement! There's also simply no hard requirement to overload an `execute` function. We have options beyond "no templates at all" and "execute takes templates and strings", for example by introducing a separate function. Why does perfect have to be the enemy of good here?