[Python-ideas] str.startswith taking any iterator instead of just tuple

Devin Jeanpierre jeanpierreda at gmail.com
Tue Jan 7 01:20:18 CET 2014


On Mon, Jan 6, 2014 at 3:39 PM, Terry Reedy <tjreedy at udel.edu> wrote:
>> Since isinstance(str, types.FunctionType) isn't True,
>
> Python has multiple builtin callable types, and users can define more, so
> you need to expand that test. Anyway, since a string is not a function
> defined by rule, it must be a function defined by a table. Since the input
> domain is a finite sequence of counts, we can and do condense the table to a
> sequence of output values. Which is an expansion of what I said.

No, I don't need to expand the test -- the limitation of the test was
the entire point. I was making fun of your argument that because the
mathematical terms are the same, therefore they must be the same in
Python. "strings are sequences in math, therefore they are in python"
is a superficial and fundamentally wrong argument. Here's another
argument of that form: "the nth element of a string is not a string in
math, therefore the nth element of a string is not a string in
Python".

That's a lie, of course.

There are too many ways that type of argument falls flat.

-- Devin


More information about the Python-ideas mailing list