How to do this in Python...
Michael Tiller
mtiller at ford.com
Mon Jan 27 09:28:09 EST 2003
More information about the Python-list mailing list
Mon Jan 27 09:28:09 EST 2003
- Previous message (by thread): How to do this in Python...
- Next message (by thread): How to do this in Python...
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Carl Banks" <imbosol at vt.edu> wrote in message news:p9EY9.499$qb1.122 at nwrddc01.gnilink.net... > Michael Tiller wrote: > > My thanks go out to those people who mentioned the "holder" idiom (rather > > than just throwing up their arms in ideological disgust at the idea of > > somebody even suggesting such a construct) > Honestly, what do you expect, considering your original post? When > you call the following code snippet "overly verbose": > > match = re.match(...) > if match: > ... What did I expect? Was this code fragment and my contention that it was verbose so inflamatory to the Python community?!? What did I expect? I expected for people to do what some did which was to point out how this is typically done in Python (e.g. the idiom in the cookbook). I expected that if people had a point to make about the functionality I needed being dangerous that they would at least press for more details about what I was doing so they could demonstrate how the code could be rewritten. What I did not expect was for people to jump all over me for daring to suggest that such functionality would ever have corrupted the Python Way. As someone who is relatively new to Python, I expected some assistance. I didn't realize that such a suggestion counted as heresy in the Python community. In any case, I'd like to point out that I said it "*seemed* unnecessarily verbose". The implication being that I thought that somebody more fluent in Python might be able to point out a way of accomplishing this in one statement (and somebody did). > people are going to get ideological on you; rightly so. You never > said why you wanted the assignment expression, and it turns out your > intended use was the only quasi-acceptable use for it. So what you are saying is that even though I had a legitimate (quasi-acceptable) use for the functionality, it was still OK for people to start criticizing me for...asking the question? I'm about ready to move back to comp.lang.tcl if this is the way people treat new users of Python around here. > If you had said "Python is incomplete because you can't do this > set-and-test idiom" instead of "Python is incomplete because it > doesn't allow assignment inside if," you would have gotten less > ideology. What exactly are the quotes here? You certainly are not quoting me. I never said what you are apparently attributing to me. I mentioned something that "seems a missing piece of functionality in Python". I was no more specific than that. > > since the "holder" idiom was > > exactly what I needed because it allows me to use if..elif..else without the > > easy to misunderstand syntax of C and C++. > > People often say Python is defective or incomplete for not allowing > assignment inside if-conditions, because you can't do this silly > idiom. Yet it never seems to occur to anyone that there are other > ways to accomplish this besides assignment-if. God forbid that they actually ask like I did. Sheesh! > I'm happy the holder idiom works for you. I prefer to do it this way, > although I rarely do it: > > > for i in [1]: > m = re.match(...) > if m: > ... > break > > m = re.match(...) > if m: > ... > break I'm happy that works for you. I'm curious if others in the Python community find that an acceptable alternative?!? > -- > CARL BANKS -- Mike
- Previous message (by thread): How to do this in Python...
- Next message (by thread): How to do this in Python...
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list