[Python-ideas] idea: Template.match function

Boris Borcic bborcic at gmail.com
Wed Oct 22 12:45:09 CEST 2008

Terry Reedy wrote:
> Boris Borcic wrote:
>> Joe Strout wrote:
>>> The point is, we already have a very pretty Template class that does 
>>> this operation in one direction; it ought to do it in the other 
>>> direction too.  The fact that it doesn't is surprising to a newbie 
>> BTW, a similar comment goes for delim.join() vs delim.split()
> A phrase like 'similar comment' is sometimes hard to expand.
> Are you saying that in 3.x .split should produce an iterator instead of 
> a list?  Or that ''.split(s) should return list(s) instead of [''] as 
> now (in 3.0 at least).

The latter, eg  sep.join(sep.split(s))==s.

But somewhat tongue-in-cheek. More generally, I guess what I am saying is that 
sequence-of-chars <--> string conversion is a particularly sore spot when 
someone tries to think/learn about the operations in Python in a structuralist 
or "mathematical" manner.

There are three quite distinct manners to infer an operation that *should* 
convert back list(s) to s, but none work.

Cheers, BB

More information about the Python-ideas mailing list