[C++-sig] Re: Boost.Python not resolving overloads

David Abrahams dave at boost-consulting.com
Sun Sep 21 05:42:07 CEST 2003


"Niall Douglas" <s_sourceforge at nedprod.com> writes:

> On 20 Sep 2003 at 22:10, David Abrahams wrote:
>
>> >> Wha???  No, it can't just guess at what you mean.  
>> >
>> > I don't see why. If one of my name()'s is zero parameters and the
>> > other one takes a string
>> 
>> Neither is zero parameters, as the error indicates.  One takes an
>> FXString and the other takes an FXFile.
>
> As in, the non-static version takes "self", yes I get that ...
>
>> Boost.Python uses the Python staticmethod wrapper to create static
>> methods.
>
> Which I used. And I should add there's no docs saying that you can't 
> mix static and non-static names though I admit it's implied by how 
> staticmethod() works.
>
>> In this case, though, the behavior is known and expected.
>
> Might it be an idea in the name of flexibility that boost.python 
> marks mixed static and non-static functions and tries matching the 
> static one first. If that fails, then it makes the first parameter 
> "self" and tries again.

It *might* be an idea.  If you can figure out how to make it work,
I'll be glad to review your patch.  From what I know about descriptors
and how method binding works, though, I bet it's nontrivial.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com





More information about the Cplusplus-sig mailing list