2010/8/23 Raymond Hettinger <raymond.hettin...@gmail.com>: > I don't have a specific proposal in mind. My main questions are > * Is there anything that hasattr(obj, key) can or should do that > can't already be done with getattr(obj, key, None)? > If not, do we really need to change anything?
For one, it's annoying when "key" can be None. > * Why do people typically use hasattr() instead getattr()? > Aren't they are really trying to just determine > whether a key exists somewhere in the MRO? > If so, then doing anything more than that is probably a surprise. It's generally more convenient that getattr(obj, "blah", None) is not None. > > P.S. The current behavior seems to be deeply embedded: Well, that's what happens when a behavior is added in 1990. :) -- Regards, Benjamin _______________________________________________ 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