[Python-ideas] f-string "debug" conversion

Nicolas Rolin nicolas.rolin at tiime.fr
Wed Oct 3 05:20:55 EDT 2018


As a user I would be really pleased with the change proposed, as I use
extensively use f-string in my logging (the fact that I have to evaluate
the string whatever the logger level is is not a performance hit for my
application), and usually the most readable logging format is
something akin to f"interesting_variable_name={interesting_variable_name},
big_list[:10]={big_list[:10]}".



2018-10-03 11:17 GMT+02:00 Chris Angelico <rosuav at gmail.com>:

> On Wed, Oct 3, 2018 at 7:09 PM Anders Hovmöller <boxed at killingar.net>
> wrote:
> >
> >
> > >> I don't really think accidents of implementation are different from
> hard requirements in Python, as it applies to alternative implementations.
> In practice if it deviates from CPython then it's broken. There is no
> language spec, there is only CPython. This has been the experience and
> approach of PyPy as far as I've understood it after having followed their
> blog over the years.
> > >>
> > >
> > > Definitely not true. There have been times when other implementors
> > > have come to python-dev and said, hey, is this part of the spec or is
> > > it an implementation detail? And the answer determines whether they
> > > care about that or not. For just a few examples:
> > >
> > > 1) Reference counting vs nondeterministic garbage collection
> > > 2) O(1) indexing/slicing of Unicode strings
> > > 3) "\N{...}" string escapes (okay, that's standardized, but optional)
> > > 4) Reuse of id() values
> > > 5) The "slots" mechanism for dunder method lookup
> > >
> > > The language spec determines, in some cases, that a CPython
> > > implementation detail has been promoted to standard. More often, it
> > > determines that other Pythons are permitted to behave differently.
> >
> > Sometimes they will come away from this list thinking they don't care
> but then their users will report bugs over and over again and they'll just
> have to do it anyway. You probably won't hear about most of those. Trees
> that fall in the forest when no one is there do in fact make a sound.
> >
>
> And sometimes, people all over the world learn to write "with
> open(...) as f:" instead of just letting f expire. There IS a language
> spec, and pretending there isn't one doesn't change that.
>
> ChrisA
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>



-- 

--
*Nicolas Rolin* | Data Scientist
+ 33 631992617 - nicolas.rolin at tiime.fr <prenom.nom at tiime.fr>


*15 rue Auber, **75009 Paris*
*www.tiime.fr <http://www.tiime.fr>*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20181003/bf63b45d/attachment.html>


More information about the Python-ideas mailing list