Can't get UDP example to work
Steven D'Aprano
steve at REMOVE-THIS-cybersource.com.au
Sun Jul 26 18:49:47 EDT 2009
On Sun, 26 Jul 2009 12:40:39 -0700, Paul Barry wrote:
> On Jul 26, 12:53 pm, Roy Smith <r... at panix.com> wrote:
>> In article
>> <148abf0f-c9e4-4156-8f16-e4e5615d3... at s6g2000vbp.googlegroups.com>,
>> Paul Barry <pauljbar... at gmail.com> wrote:
>>
>> > host = '127.0.0.1' # Bind to all interfaces
>>
>> This threw me off the track for a little while. The comment is wrong!
>> You're not binding to all interfaces, you're binding specifically to
>> the loopback interface. For what you're doing, it's fine, but the
>> comment is still wrong.
>
> You are right. The example in the book actually has
>
> host = ''
>
> So the comment is correct. In trying to debug what was going on, I put
> 127.0.0.1 to see if that had something to do with it, which it didn't.
Now I have to quote Aahz's email sig:
"At Resolver we've found it useful to short-circuit any doubt and just
refer to comments in code as 'lies'. "
--Michael Foord paraphrases Christian Muirhead on python-dev, 2009-03-22
> But why not use
>
> print buf[0]
>
> instead of
>
> sys.stdin.write(buf[0])
>
> that much, I don't know.
print adds a trailing newline to the output, so the two lines aren't
quite equivalent.
--
Steven
More information about the Python-list
mailing list