How to create a socket.socket() object from a socket fd?

Chris Angelico rosuav at gmail.com
Sat Jan 21 17:52:13 EST 2017


On Sun, Jan 22, 2017 at 9:41 AM, Grant Edwards
<grant.b.edwards at gmail.com> wrote:
>  |  __init__(self, family=2, type=1, proto=0, _sock=None)
>  |
>
> Ah! There's a keyword argument that doesn't appear in the docs, so
> let's try that...

That's marginally better than my monkeypatch-after-creation
suggestion, but still broadly the same. Your code may well break in
other Python implementations, but within CPython 2.7, you should be
pretty safe.

ChrisA



More information about the Python-list mailing list