From: Peter Johnson Date: Sun, 16 Apr 2006 20:28:07 +0000 (-0000) Subject: symrec.pxi: Implement __contains__ so that "'foo' in SymbolTable" works. X-Git-Tag: v0.5.0~17^2~10 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3c5cabcd47d3040bae002876ec63fa5cff085b10;p=yasm symrec.pxi: Implement __contains__ so that "'foo' in SymbolTable" works. svn path=/trunk/yasm/; revision=1494 --- diff --git a/tools/python-yasm/symrec.pxi b/tools/python-yasm/symrec.pxi index 94166865..5f8e0a93 100644 --- a/tools/python-yasm/symrec.pxi +++ b/tools/python-yasm/symrec.pxi @@ -189,6 +189,11 @@ cdef class SymbolTable: raise KeyError return __make_symbol(symrec) + def __contains__(self, key): + cdef yasm_symrec *symrec + symrec = yasm_symtab_get(self.symtab, key) + return symrec != NULL + def keys(self): l = [] yasm_symtab_traverse(self.symtab, l, __symtab_keys_helper)