PEP 358 and operations on bytes

Ben Finney bignose+hates-spam at benfinney.id.au
Tue Oct 3 22:56:31 EDT 2006


Steve Holden <steve at holdenweb.com> writes:

> This would just be bloat

How would it be bloat? I'm describing a situation where the existing
methods merely move, being implemented in a common ancestor rather
than directly in the concrete sequence classes.

> without any use cases being demonstrated. What is your crying need
> for these methods?

I don't think I claimed a crying need for one. Consistency, where not
foolish, is desirable.

I don't deny that there is work involved; my suggestion was in the
context of talking about a common ancestor to 'bytes' and 'str', in
order to refactor some of the common methods.

> Your *real* generalisation of the string method would actually
> require you to write
>
>      ["foo", "bar", "spam", "baz", "quux", "wibble"].startswith(["foo"])

Yes, you're right. I realised that after sending, but didn't correct
it.

> Python didn't get to be the language it is today by adding
> unnecessary hypergeneralisations on a whim. Show me how these
> methods will improve the daily lives of programmers and I'll
> champion them to the developers, but I don't think the world will be
> beating a path to your door.

Again, I'm discussing a still-nascent suggestion for a common sequence
ancestor; there are no demands here. If there is to be generalisation,
I'm merely pointing out that it could be at a higher level and be more
useful.

If nothing else, it would lend more coherence to the "str is a
sequence" confusion if *all* sequences shared some str-derived
methods.

-- 
 \          "I used to be a narrator for bad mimes."  -- Steven Wright |
  `\                                                                   |
_o__)                                                                  |
Ben Finney




More information about the Python-list mailing list