[Python-ideas] One way to do format and print
Sven R. Kunze
srkunze at mail.de
Thu Sep 10 19:43:40 CEST 2015
Of course I would not want to force you, Rob.
I believe in progress and progress is achieved through change. So, the
best method for change I know of are deprecations: not all changes come
bundled but singly and with time to prepare.
To me, it's just a minor deficiency in Python's own vision.
Best,
Sven
On 10.09.2015 01:32, Rob Cliffe wrote:
> I use %-formatting.
> Not because I think it's so wonderful and solves all problems
> (although it's pretty good), but because it appeared to be the
> recommended method at the time I learned Python in earnest. If I were
> only learning Python now, I would probably learn str.format or
> whatever it is.
> I *could* learn to use something else *and* change all my working
> code, but do you really want to force me to do that?
> I would guess that there are quite a lot of Python users in the same
> position.
> Rob Cliffe
>
> On 09/09/2015 17:05, Sven R. Kunze wrote:
>> On 09.09.2015 02:09, Andrew Barnert via Python-ideas wrote:
>>> I think it's already been established why % formatting is not going
>>> away any time soon.
>>>
>>> As for de-emphasizing it, I think that's already done pretty well in
>>> the current docs. The tutorial has a nice long introduction to
>>> str.format, a one-paragraph section on "old string formatting" with
>>> a single %5.3f example, and a one-sentence mention of Template. The
>>> stdtypes chapter in the library reference explains the difference
>>> between the two in a way that makes format sound more attractive for
>>> novices, and then has details on each one as appropriate. What else
>>> should be done?
>>
>> I had difficulties to find what you mean by tutorial. But hey, being
>> a Python user for years and not knowing where the official tutorial
>> resides...
>>
>> Anyway, Google presented me the version 2.7 of the tutorial. Thus,
>> the link to the stdtypes documentation does not exhibit the note of,
>> say, 3.5:
>>
>> "Note: The formatting operations described here exhibit a variety of
>> quirks that lead to a number of common errors (such as failing to
>> display tuples and dictionaries correctly). Using the newer
>> str.format() interface helps avoid these errors, and also provides a
>> generally more powerful, flexible and extensible approach to
>> formatting text."
>>
>> So, adding it to the 2.7 docs would be a start.
>>
>>
>> I still don't understand what's wrong with deprecating %, but okay. I
>> think f-strings will push {} to wide-range adoption.
>>
>>
>> Best,
>> Sven
>> _______________________________________________
>> 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/
>>
>>
>> -----
>> No virus found in this message.
>> Checked by AVG - www.avg.com
>> Version: 2014.0.4830 / Virus Database: 4365/10609 - Release Date:
>> 09/09/15
>>
>>
>
More information about the Python-ideas
mailing list