• Formatted Output and Argument Parsing (was: Re: Flubbed it in the secon

    From 2QdxY4RzWzUUiLuE@potatochowder.com@21:1/5 to Chris Angelico via Python-list on Wed May 29 09:05:16 2024
    On 2024-05-29 at 17:14:51 +1000,
    Chris Angelico via Python-list <python-list@python.org> wrote:

    I wouldn't replace str.format() everywhere, nor would I replace
    percent encoding everywhere - but in this case, I think Thomas is
    correct. Not because it's 2024 (f-strings were brought in back in
    2015, so they're hardly chronologically special), but because most of
    this looks like debugging output that can take advantage of this
    feature:

    print(f"if block {name[index]=} {index=}")

    defsnark:

    After years of getopt (and even more, if you include non-Python
    experience), I'm glad I decided to wait a decade before chugging the
    optparse koolaid.

    (For the history-impaired, getopt existed long before Python and will
    likely exist long after it, but getopt's "replacement" optparse lasted
    only from 2003 until 2011.)

    That said, I agree that the = thing makes f-strings eminently useful for debugging, and I wholeheartedly agree with not fixing things that aren't broken.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)