Message409505
Indeed the `__format__` style offers a lot more options (see https://pyformat.info/).
Regarding performance you make an interesting point.
One possible solution is to allow f-strings _only_ if there are no args/kwargs.
In that one case formatting would explicitly be skipped.
This could be represented at type-level with an overload:
# case: Logger does formatting. Only literal string template allowed.
@overload
def debugf(msg: Literal[str], *args, exc_info: bool = False, **kwargs):
# wrap
# case: User does formatting. No args/kwargs allowed.
@overload
def debugf(msg: str, *, exc_info: bool = False):
# wrap `msg` in something that will not allow further formatting. |
|
Date |
User |
Action |
Args |
2022-01-02 16:58:02 | ariebovenberg | set | recipients:
+ ariebovenberg, vinay.sajip, eric.smith, docs@python, erlendaasland |
2022-01-02 16:58:01 | ariebovenberg | set | messageid: <1641142681.95.0.761280913923.issue46200@roundup.psfhosted.org> |
2022-01-02 16:58:01 | ariebovenberg | link | issue46200 messages |
2022-01-02 16:58:01 | ariebovenberg | create | |
|