400 # messy!
401 if not ("id" in card_data and isinstance(card_data["id"], int)):
402 raise TypeError("card_data must contain an id and it must be an integer")
403 if not "studiableContainerType" in card_data:404 warn("card_data does not contain a studiableContainerType")
405 if not (
406 "studiableContainerId" in card_data
Tests for membership should use the form x not in the_list
rather than not x in the_list
. The former example is simply more readable.
if not x in authors:
authors.append(x)
if x not in authors:
authors.append(x)