broken examples in reference? Help??

paul at fizzylab.com paul at fizzylab.com
Sat Jun 17 00:52:47 EDT 2000


you guessed it: i wasn't sufficiently caffienated and missed those parens.



David Bolen wrote:

> paul at fizzylab.com writes:
>
> > I am trying to work with python and it seems quite
> > straightforward most of the time, but I fear I may have a
> > broken binary or something else wrong.
>
> > I have typed verbatim an example from the python essential
> > reference and it doesn't seem to work: it just hangs. (...)
>
> Nope, it's just a typo - the line:
>
> > h.endheaders
>
> Should be a method call, so instead you should use:
>
>     h.endheaders()
>
> Written the way you have it, it's just going to represent the function
> object.  If you feed these statements in interactively, you'll see the
> output from the interpreter:
>
>     >>> h.endheaders
>     <method HTTP.endheaders of HTTP instance at 80eb90>
>
> so it's just printing the value of h.endheaders (the method reference)
> and not actually executing it, thus the headers are never terminated.
> Actually the statement doesn't really do anything, but it's the nature
> of the interpreter to print the value of any line that produces
> something other than None.
>
> My Python Essential Reference copy does have the () on this line, but
> I just bought it, so it may be a more recent printing than yours and
> perhaps it used to be a typo in the book.  (Or perhaps you just missed
> it when typing it in?  :-))
>
> --
> -- David
> --
> /-----------------------------------------------------------------------\
>  \               David Bolen            \   E-mail: db3l at fitlinxx.com  /
>   |             FitLinxx, Inc.            \  Phone: (203) 708-5192    |
>  /  860 Canal Street, Stamford, CT  06902   \  Fax: (203) 316-5150     \
> \-----------------------------------------------------------------------/




More information about the Python-list mailing list