SPAM-LOW: Re: Function/method returning list of chars in string?

Terry Reedy tjreedy at udel.edu
Tue Jun 9 15:42:49 EDT 2009


Hendrik van Rooyen wrote:

> I should have known - you use a string method to get a list of words,
> but you have to go to the list to get a list of characters from a string.

That is symmetry.

> There is no string method to do it, which is what I am complaining
> about.

That would be asymmetry.

> 
> Is there a reason for this, or is the lack of symmetry just an historical
> artefact?

A lack of perception to see the symmetry that is there.

Classes create instances of the class when called.

Sometimes alternate constructors are needed when there is more than one 
possible way to create an instance from a given input.  In the case of 
str(iterable), one could want either a string representing the iterable 
itself, just as with non-iterables, or a string representing the 
concatenated contents of the iterable.  Str.join implements the second 
choice, with an added string parameter to allow a constant string to be 
interpolated between the joined items.

> The link that jon vs python supplied is interesting.

Yes.  Mr. Shaw suffers from the same disease of 'neglect' that he 
accuses others of.  See my other response in this thread.

Terry Jan Reedy




More information about the Python-list mailing list