implicit conversion
Benjamin Schmeling
Benjamin_Schmeling at gmx.de
Mon Jan 31 13:07:33 EST 2005
Alex Martelli wrote:
> Benjamin Schmeling <Benjamin_Schmeling at gmx.de> wrote:
> ...
>
>
>> 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__.
>>
>
>
> Perhaps adding to your bigint class a constructor (not declared as
> ``explicit'', if you're coding C++) which accepts as its argument a
> python long might help...?
>
>
> Alex
>
>
I have got such an constructor now (my_type(long_)), but nevertheless
implicit conversion from long to my_type isn't supported. Any other ideas?
Benjamin
More information about the Python-list
mailing list