Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 20th, 2012  |  syntax: None  |  size: 0.36 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. 'in' operator with boost::python
  2. >>> myObject=MyClass()
  3. >>> 'abc' in myObject.keys()
  4. False
  5. >>> 'abc' in myObject
  6. ArgumentError: Python argument types in
  7.     MyClass.__getitem__(MyClass, int)
  8. did not match the C++ signature:
  9.     __getitem__(MyClass {lvalue}, std::string)
  10.        
  11. 'abc' in myObject
  12.        
  13. for i in myObject:
  14.     if myObject[i] == 'abc':
  15.         return true