On Wed, 29 Jun 2005, Peter Szinek wrote:

> Hello Denise,
>
> How about this:
>
> myjar = cookielib.CookieJar()
> for cookie in myjar:
>      print cookie.value
>
> In this case the above code should print a single 'B'.


Yes, whenever the documentation talks about something being "iterable",
they really mean that we can use a for loop across it.  It does seem a
little odd that this appears to be a primary way to access the cookies in
a cookie jar:

    http://www.python.org/doc/lib/node534.html

I wonder why; I haven't been able to figure out a good reason for this
kind of interface.  Are cookie jars files known to be large?

I do hope it's not a matter of preserving the metaphor of reaching into a
cookie jar to grab cookies one at a time... *grin*

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to