How to test a URL request in a "while True" loop

Steve Holden steve at holdenweb.com
Wed Dec 30 20:55:49 EST 2009


Brian D wrote:
[...]
> I'm definitely acquiring some well-deserved schooling -- and it's
> really appreciated. I'd seen the "is/is not" preference before, but it
> just didn't stick.
> 
Yes, a lot of people have acquired the majority of their Python
education from this list - I have certainly learned a thing or two from
it over the years, and had some very interesting discussions.

is/is not are about object identity. Saying

  a is b

is pretty much the same thing as saying

  id(a) == id(b)

so it's a test that two expressions are references to the exact same
object. So it works with None, since there is only ever one value of
<type 'NoneType'>.

Be careful not to use it when there can be several different but equal
values, though.

> I see now that "pass" is redundant -- thanks for catching that.
> 
regards
 Steve
-- 
Steve Holden           +1 571 484 6266   +1 800 494 3119
PyCon is coming! Atlanta, Feb 2010  http://us.pycon.org/
Holden Web LLC                 http://www.holdenweb.com/
UPCOMING EVENTS:        http://holdenweb.eventbrite.com/




More information about the Python-list mailing list