New-style string formatting (Was: Re: Tuple "detection")

Gerrit Holl gerrit at nl.linux.org
Tue May 20 15:11:01 EDT 2003


Daniel Dittmar schreef op dinsdag 20 mei om 19:08:16 +0000:
> > because the '%' is redundant; it's a much smaller change:
> 
> redundant only for the common case of
> "string %s %s" % (value1, value2)
> but not for
> "string %s %s" % db.getRow ()

This would become:

"string %s %s"(*db.getrow())

And it works if getrow returns a list: now it doesn't, which is bad.

> and not for the also quite common case of
> "string %(name1)s" % locals ()

"string %(name1)s"(**locals())

It is more orthogonal with the behaviour of sequences and mappings passed to
callables.

yours,
Gerrit.

-- 
44. If any one take over a waste-lying field to make it arable, but is
lazy, and does not make it arable, he shall plow the fallow field in the
fourth year, harrow it and till it, and give it back to its owner, and for
each ten gan (a measure of area) ten gur of grain shall be paid. 
        -- Hammurabi, Code of Law
--
Asperger Syndroom - een persoonlijke benadering:
	http://people.nl.linux.org/~gerrit/
Het zijn tijden om je zelf met politiek te bemoeien:
	http://www.sp.nl/





More information about the Python-list mailing list