I have a function

def updateit(self,**mydict):

which is intended to update a dictionary self.somedict. 

If there are keys in mydict that are not in self.somedict I want them
returned in a new dict.

here is what i am doing now:

errdict = dict([(a,b) for a,b in mydict.items() if not a in self.somedict])

I then test (if errdict) and raise an exception that contains errdict
as an attribute. Else i update self.somedict.

Is there something other than a list comprehension in a dict function
that can do this?

Thanks!
-- 

***********************************
See there, that wasn't so bad.
***********************************
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to