Indented multi-line strings

Chris Angelico rosuav at gmail.com
Fri Jun 1 17:57:43 EDT 2018


On Sat, Jun 2, 2018 at 7:00 AM, Peter Pearson <pkpearson at nowhere.invalid> wrote:
> On Fri, 1 Jun 2018 15:57:58 +0100, Paul Moore <p.f.moore at gmail.com> wrote:
>> On 1 June 2018 at 15:36, Dan Strohl via Python-list
>><python-list at python.org> wrote:
>>> So... how does one go about suggesting changes to the built in types?
> [snip]
>>
>> Why does this need to be a string method? Why can't it be a standalone
>> function?
>
> Yes, please, let's content ourselves with a standalone function.
>
> Adding features to a language imposes costs in several ways, including
> hindering newcomers and making code version-dependent.  To full-time
> Python developers, these costs appear small, because they are amortized
> over a lot of Python activity; but they are encumbrances to the spread
> and casual use of the language.  It seems as if the destiny of every
> language is to be adorned by its enthusiasts with so many arcane and
> specialized optimizations -- every one an obvious improvement -- that
> the world's interest drifts to something newer and cleaner.

How will a method be worse than a standalone function? Please explain
this. A method is a lot easier to discover than a stdlib module
function, which is in turn IMMENSELY more discoverable than anything
on pypi.

If you dislike adding features to a language on the basis that it
makes the language harder to learn, remember that you instead force
one of three even worse options:

1) Messy code because people unindent inside their source code,
creating wonky indentation (which Python usually avoids)

2) Forcing readers to look up the third-party module you're using
before they can understand your code

3) Forcing readers to look up your ad-hoc function before
understanding your code.

All of these make it harder to understand your code, specifically
BECAUSE the language doesn't have the requisite feature. Well-written
language features are good, not bad, for readability.

ChrisA



More information about the Python-list mailing list