implicit conversion

Benjamin Schmeling Benjamin_Schmeling at
Mon Jan 31 14:01:56 CET 2005


I am working on exposing a bigint class to python.  Now I've got the 
problem that methods which take an bigint as
an parameter do not accept Python longs.

For example:
import _PythonLiDIA

Traceback (most recent call last):
File "", line 132, in ?
Boost.Python.ArgumentError: Python argument types in
  _PythonLiDIA.gcd(bigint, long)
did not match C++ signature:
  gcd(LiDIA::bigint, LiDIA::bigint)

I don't know how to achieve implicit conversion at this point, turning an
long automatically into an bigint. The other way round, turning an bigint
into long can be realized by defining __long__.

Can someone help me please?


More information about the Python-list mailing list