
May 6, 2021
1:50 a.m.
Bruce Leban writes:
where *!j* means join. It could optionally take a separator string as in this example:
Converters *could* take arguments but they currently don't: it's a simple switch on a str argument. We already have one complex minilanguage inside {}, do we really want another? Maybe if we use regexps .... ;-) But seriously, if you want complex conversions, you can just call a function in there, which gives you arguments if you want them. Or in this context you can wrap the object in a proxy with an appropriate __format__. This can be quite generic, and allows you to put the arguments into the format spec. Steve