On Fri, Feb 1, 2013 at 3:58 AM, Guido van Rossum <guido@python.org> wrote:
hasattr() smells bad. It also has namespace issues (hasattr(transport,
"write") returns true) and if people forget to use it (perhaps because
the transport they normally use always has a certain attribute) their
code is brittle. Defining a new API with a string key signals clearly
that the value may or may not exist, and reminds people to test the
result for None. (Of course they can forget that too. But it still
feels different to me.)

I understand. It's a good solution for clearly separating the standard transport api from the extra-and-specific api. We want to make it obvious when a protocol is breaking the transport abstraction - to promote playing nicely with different transports.