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
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to