May 25, 2010

Tip of the Day #1 - in or not ?

I really love those small python's built in functions and operators. How to check if variable is in some collection ?

>>> z = x in s
>>> z
True
z will return True if x is in s. Isn't that cool or what ?

2 comments:

  1. you have thatfeature in your favorite Java also and in any language with collections like lists or dicts, wait for the ASD lectures next semester:)

    ReplyDelete
  2. I agree, but still you have to remember about it :)

    ReplyDelete