]> granicus.if.org Git - yasm/commitdiff
symrec.pxi: Implement __contains__ so that "'foo' in SymbolTable" works.
authorPeter Johnson <peter@tortall.net>
Sun, 16 Apr 2006 20:28:07 +0000 (20:28 -0000)
committerPeter Johnson <peter@tortall.net>
Sun, 16 Apr 2006 20:28:07 +0000 (20:28 -0000)
svn path=/trunk/yasm/; revision=1494

tools/python-yasm/symrec.pxi

index 94166865886d000a4363746313ac66e207fb24ea..5f8e0a935d491b93dd9144107c4f914318735b2f 100644 (file)
@@ -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, <void *>l, __symtab_keys_helper)