This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: incompatible, but nice strings improveme
Type: Stage:
Components: Interpreter Core Versions: Python 2.3
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: loewis, rhettinger, yozh
Priority: normal Keywords: patch

Created on 2002-07-08 14:25 by yozh, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
Python-mstring-0.1-yozh.diff yozh, 2002-07-08 14:25 the patch
Messages (6)
msg40523 - (view) Author: Stepan Koltsov (yozh) Date: 2002-07-08 14:25
This patch changes interpretation of multiline strings
(desn't matter, single, double quoted (when NL escaped
with backslash), triple quoted).

After applying this patch, first: first charachter
after opening quote is ignored, if it is NL, example:

"""
la-la-la
"""

will be equivalent of

"""la-la-la
"""

First variant looks better, isn't is?

Second: all spaces after NL before first nonblack char
but no more then current indentation are ignored, example:

New:

def f():
    """
    This is docstring,
    mama-mama,
  apple, banana
     """

is equivalent of old:

def f():
    """This is docstring,
mama-mama,
apple, banana
"""

Patch enabled if PyPARSE_STRIPPED_STRINGS defined. I
suggest you to apply patch but undefine
PyPARSE_STRIPPED_STRINGS until python-4 ;-)

I am sure, that this semantics is right, as
alternative, I suggest adding new modifier 'i' to
strings, like 'u' and 'r', for inst. i'iddqd'.

P. S. AFAIU, editing of parsermodule.c needed.

P. P. S. I am sorry, my English suck :-(
msg40524 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2002-07-08 15:48
Logged In: YES 
user_id=21627

The first part of your patch is not needed, you can just as
fine write

"""\
la-la-la
"""

to escape the first newline.

The second patch is probably not needed either, since you
can easily write library routines that deal with that kind
of stripping. In fact, pydoc already does that transformation.
msg40525 - (view) Author: Stepan Koltsov (yozh) Date: 2002-07-08 16:06
Logged In: YES 
user_id=247706

I think the first part is still needed since
1. In r"""\
lalala
""" backslash doesn't escape NL
2. I think it looks better.

About second part:
1. Additional library routines make program text less readable.
2. They cannot know what indentation in spaces was where
string constant appeared.

msg40526 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2002-07-09 08:13
Logged In: YES 
user_id=21627

In that case,I think your proposed change will be highly
debated. That means you will have to write a PEP first if
you want to see it implemented (even if it is only an option).
msg40527 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2002-09-08 04:09
Logged In: YES 
user_id=80475

This proposal does not have much of a chance.  It offers 
only a minor gain (debatable) but assures incompatability.

I recommend that the OP take Martin's hint and withdraw 
or close the patch.  If you need it badly, a PEP is essential.
msg40528 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2002-10-13 12:55
Logged In: YES 
user_id=21627

Given that PEP 295 was rejected, I also reject this patch.
History
Date User Action Args
2022-04-10 16:05:29adminsetgithub: 36866
2002-07-08 14:25:19yozhcreate