any way to customize the is operator?

Aahz aahz at pythoncraft.com
Sat Feb 11 12:29:53 EST 2006


In article <1139618017.571180.23790 at g47g2000cwa.googlegroups.com>,
Lonnie Princehouse <finite.automaton at gmail.com> wrote:
>
>> Why did you want to customize "is"?
>
>Well, mostly out of principle ;-)
>
>But also because I'm wrapping a C library which passes around C structs
>which are wrapped in shim C++ classes for a Boost.Python layer.  Boost
>Python does a marvelous job of translating between Python and C++ data
>types; when a C structure is returned, it magically translates that
>structure into a Python wrapper.   The problem is that a _new_ Python
>wrapper is created every time a pointer is returned, even if a  wrapper
>already exists for that particular pointer.

Then you need to fix Boost.Python.  This cannot and will not get fixed at
the Python level -- how can Python possibly know that they are the same
objects?
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"19. A language that doesn't affect the way you think about programming,
is not worth knowing."  --Alan Perlis



More information about the Python-list mailing list