Martin v. Löwis wrote: > Apparently, people favor hasattr over catching > AttributeError. I'm not sure why this is - I would probably > rewrite them all to deal with AttributeError if I use the new > syntax in the first place. Actually, I prefer using getattr with a default value over either of those, wherever possible. AttributeError can be raised by too many things for me to feel comfortable about catching it. This suggests that any proposed getattr syntax should include a way of specifying a default value. I'm still -1 on the basic idea, though, on the grounds of YAGNIOE (You Aren't Going to Need It Often Enough). -- Greg
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