[Python-Dev] PEP 295 - Interpretation of multiline string constants

Stepan Koltsov yozh@mx1.ru
Thu, 25 Jul 2002 21:55:28 +0400


On Thu, Jul 25, 2002 at 07:27:07PM +0200, Fredrik Lundh wrote:
> > > This is an incompatible change. Your PEP does not address
> > > how to deal with this at all. I will be forced to reject it unless
> > > you come up with a transition strategy (in fact, I don't even want
> > > to consider your proposal unless you deal with this).
> > 
> > For most strings this change will not change program result
> 
> and how on earth do you know that?

I've seen output of `grep -rwC '"""' Python/Lib/` and
`egrep -rwC '= *"""' Python/Lib/`. Most strings are
docstrings ;-)

> > (for example number of spaces doesn't matter in SQL queries).
> 
> so why do all your examples use SQL queries?

Because I saw this defect of Python first when I wrote SQL queries.

f():
	q = """my
	query""" % vars
	if debug:
		print q # looks bad

> > For others I suggested (in section 'Alternatives') flags 'i' and 'o'
> > for string constants.
> 
> if you want to interpret multiline strings in a different way, why
> cannot you just do like everyone else, and use a function?
> 
>     mystring = SQL("""
>         blablabla
>     """)

Functions don't know current indentation.

> (as a bonus, that approach makes it trivial to embed files, images,
> xml structures, etc...)
> 
> a big -1 from here.

:-(

-- 
mailto: Stepan Koltsov <yozh@mx1.ru>