Formatted Output and Argument Parsing (was: Re: Flubbed it in the second interation through the string: range error... HOW?)

Liste des GroupesRevenir à cl python 
Sujet : Formatted Output and Argument Parsing (was: Re: Flubbed it in the second interation through the string: range error... HOW?)
De : 2QdxY4RzWzUUiLuE (at) *nospam* potatochowder.com
Groupes : comp.lang.python
Date : 29. May 2024, 15:05:16
Autres entêtes
Message-ID : <mailman.60.1716987926.2909.python-list@python.org>
References : 1 2 3 4
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.

Date Sujet#  Auteur
29 May 24 o Formatted Output and Argument Parsing (was: Re: Flubbed it in the second interation through the string: range error... HOW?)12QdxY4RzWzUUiLuE

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal