[Python-Dev] OOps (was: No 1.6! (was Re: A REALLY COOL PYTHON FEATURE:))

Moshe Zadka Moshe Zadka <moshez@math.huji.ac.il>
Thu, 18 May 2000 08:36:09 +0300 (IDT)


[Tim Peters, on sequenceness of strings]
>     for ch in string:
>         muck w/ the character ch
> 
> is a common idiom.

Hmmmm...if you add a new method,

for ch in string.as_sequence():
	muck w/ the character ch

You'd solve this.

But you won't manage to convince me that you haven't used things like

string[3:5]+string[6:] to get all the characters that...

The real problem (as I see it, from my very strange POV) is that Python
uses strings for two distinct uses:

1 -- Symbols
2 -- Arrays of characters

"Symbols" are ``run-time representation of identifiers''. For example,
getattr's "prototype" "should be"

getattr(object, symbol, object=None)

While re's search method should be

re_object.search(string)

Of course, there are symbol->string and string->symbol functions, just as
there are list->tuple and tuple->list functions. 

BTW, this would also solve problems if you want to go case-insensitive in
Py3K: == is case-sensitive on strings, but case-insensitive on symbols.

i've-got-this-on-my-chest-since-the-python-conference-and-it-was-a-
  good-opportunity-to-get-it-off-ly y'rs, Z.
--
Moshe Zadka <moshez@math.huji.ac.il>
http://www.oreilly.com/news/prescod_0300.html
http://www.linux.org.il -- we put the penguin in .com