On 2/11/07, Ben North <ben at redfrontdoor.org> wrote: [SNIP] > * The draft currently allows a two-argument form, to supply a default > value if the object has no attribute of that name. This mimics the > behaviour of the three-argument form of getattr, but looks a bit wrong: > > s = obj.(attr_name, 'default string') > > I agree that it looks odd, but perhaps the extra expressive power > gained might be worth the oddness. I don't think it is. getattr can just be kept around if need be in order to support this use case. It just makes it look like too much of a function call at that point to me, especially if someone ends up writing some expression that is so long that they put in a newline between the two values: s = obj.(attr_name, 'default_string') So -1 on the two-item version, +0 on the one-item version. -Brett
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4