Javier Ruere wrote:
> I should also add the most simple and obvious implementation which is also
> the fastest:
>
>
> class Test:
> def __init__(self, dict):
> self.somedict = dict
>
> def updateit(self, **mydict):
> errdict = {}
> for k, v in mydict.iteritems():
> if k not in self.somedict:
> self.somedict[k] = v
> errdict[k] = v
>
> if (not errdict):
> raise Exception(errdict)
My understanding of the OP is that he wants an exception if there are items in
errdict. Also this solution will change self.somedict even in the error case
which may not be desirable.
Kent
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor