On Thu, 22 Oct 2020 at 13:36, Chris Angelico <rosuav@gmail.com> wrote:
On Thu, Oct 22, 2020 at 8:22 PM Steven D'Aprano <steve@pearwood.info> wrote:
On Wed, Oct 21, 2020 at 07:17:21PM -0700, Guido van Rossum wrote:
Hmm, if the above is acceptable, maybe f-strings are still the logical next step, since they bring the format and the target name together again.
That's not the only way to bring the format and target name together. Both brace-style and percent-style can do that:
'{number:d}' '%(number)d'
Maybe, but if it isn't an actual syntactic construct, there's no value - at best, all you can do is return a dictionary, and there's no convenient way to assign those to locals.
I think that there's *plenty* of value. Returning a dictionary (or maybe a dataclass) is far from merely being "at best", it's a common, well-known, and easy to use pattern. Libraries like argparse use it very successfully. Direct assignment to locals would require syntax, but I think a lot of people in this thread consider that to be at best a minor additional convenience - and many people have argued that the pitfalls are a lot worse than the benefits, and consider direct assignment to locals to be a disadvantage, rather than a benefit. Paul