[Python-Dev] [NPERS] Re: a feature i'd like to see in python #2: indexing of match objects (original) (raw)
Michael Urman murman at gmail.com
Thu Dec 7 15:47:01 CET 2006
- Previous message: [Python-Dev] [NPERS] Re: a feature i'd like to see in python #2: indexing of match objects
- Next message: [Python-Dev] [NPERS] Re: a feature i'd like to see in python #2: indexing of match objects
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 12/6/06, Josiah Carlson <jcarlson at uci.edu> wrote:
Special cases aren't special enough to break the rules.
Sure, but where is this rule that would be broken? I've seen it invoked, but I've never felt it myself. I seriously thought of slicing as returning a list of elements per range(start,stop,skip), with the special case being str (and then unicode followed)'s type preservation.
This is done because a list of characters is a pain to work with in most contexts, so there's an implicit ''.join on the list. And because assuming that the joined string is the desired result, it's much faster to have just built it in the first place. A pure practicality beats purity argument.
We both arrive at the same place in that we have a model describing the behavior for list/str/unicode, but they're different models when extended outside.
Now that I see the connection you're drawing between your argument and the paper, I don't believe it's directly inspired by the paper. I read the paper to say those who could create and work with a set of rules, could learn to work with the correct rules. Consistency in Python makes things easier on everyone because there's less to remember, not because it makes us better learners of the skills necessary for programming well. The arguments I saw in the paper only addressed the second point.
Michael Urman http://www.tortall.net/mu/blog
- Previous message: [Python-Dev] [NPERS] Re: a feature i'd like to see in python #2: indexing of match objects
- Next message: [Python-Dev] [NPERS] Re: a feature i'd like to see in python #2: indexing of match objects
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]