[C++-sig] Overriding operator == and = for None
Roman Yakovenko
roman.yakovenko at gmail.com
Wed Jun 21 20:12:58 CEST 2006
On 6/21/06, Will Lee <lee.will at gmail.com> wrote:
> Is there a way I can override the operator == and = for a wrapped c++ object
> to take in a Python None type?
I could be wrong, but you can not change semantic of = ( assignment operator )
As for the ==( equal operator ), you can overload == that takes
boost::python::object and then test it for being None.
I am almost sure that what you are trying to do should be rethought.
For example:
x == None will work, but x is None will not. This can lead to bugs.
--
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
More information about the Cplusplus-sig
mailing list