computing with characters

Diez B. Roggisch deets at nospam.web.de
Wed Apr 30 10:53:57 EDT 2008


> However, join() is really bizarre.  The list rather than the
> separator should be the leading actor.

Certainly *not*! This would be the way ruby does it, and IMHO it does 
not make sense to add join as a string-processing related 
method/functionality to a general purpose sequence type. And as others 
have pointed out, this would also mean that e.g.

def sgen():
     for i in xrange(100):
        yield str(i)

sgen.join(":")

wouldn't work or even further spread the join-functionality over even 
more objects.

An argument for the original ord/chr debate btw is orthogonality: if you 
want ord to be part of a string, you'd want chr to be part of ints - 
which leads to ugly code due to parsing problems:

(100).chr()



Diez



More information about the Python-list mailing list