[Python-ideas] PEP 3156: getting the socket or peer name from the transport
Yuval Greenfield
ubershmekel at gmail.com
Fri Feb 1 22:53:14 CET 2013
On Fri, Feb 1, 2013 at 3:58 AM, Guido van Rossum <guido at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130201/979aaf56/attachment.html>
More information about the Python-ideas
mailing list