On 03.06.2014 21:56, Wolfgang Maier wrote:
- the tricky part is what to do with keys that are encountered for the
first time and, thus, don't have a set associated with them yet.
Here, dict.setdefault() will help you
(https://docs.python.org/2.7/library/stdtypes.html?highlight=setdefault#dict.setdefault).
hint: your_dict(your_key, set()).add(the_gene) will work whether or not
the key has been encountered before or not.
I meant:
your_dict.setdefault(your_key, set()).add(the_gene)
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor