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

Carl Banks pavlovevidence at
Tue Jun 9 18:06:21 EDT 2009

On Jun 9, 12:42 pm, Terry Reedy <tjre... at> wrote:
> 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.

But then how do you rationalize str.split(), which is a method of str
but a constructor of list?

Perhaps instead of worrying about symmetry all the time we should just
accept the inevitability that things will always be asymmetric and
impure from someone's perspective.  Terry's symmetry is Hendrik's
asymmetry and vice versa.

Carl Banks

More information about the Python-list mailing list