Skip to content

Seeking Feedback for Potential PR: Method Binder IsAssignable From #529

Open

Description

@jaredbroad

One of our team (@mchandschuh) suggested this line could be substituted for a "IsAssignableFrom" check. https://github.com/pythonnet/pythonnet/blob/master/src/runtime/methodbinder.cs#L60

The plan would be to make the generic-locator code more effective.

mhandschuh [4:11 PM]
I would recommend looking at the MethodBinder -- it appears to be matching directly on type and not using Type.IsAssignableFrom which should properly handle super types (going from SimpleMovingAverage to IndicatorBase)

We're not really sure the flow on impacts for the whole library -- is this feasible; or are other parts of the code dependent on this = statement?

Activity

  1. changed the title [-]Suggestion / Seeking Feedback for Potential PR:[/-] [+]Seeking Feedback for Potential PR: Method Binder IsAssignable From[/+] on Aug 25, 2017
  2. mchandschuh commented on Aug 25, 2017

    @mchandschuh

    My python skills are severely lacking, so I'll just ask here.

    Is there a test that verifies derived types can be passed as arguments to functions?

    Does pythonnet support invoking the AcceptsBaseClass method with an instance of SubClass ?

    class BaseClass { }
    class SubClass : BaseClass { }
    static class Method
    {
        public static void AcceptsBaseClass(BaseClass arg) { }
    }

    Thanks!

  3. den-run-ai commented on Aug 25, 2017

    @den-run-ai
    Contributor

    @jaredbroad @mhandschuh @AlexCatarino the issue is much deeper. As a starter take a look at this PR which I gave up on merging:

    #217

    For more of overloading stuff have a look at this meta-issue (this is one of my frequent nightmares):

    #265

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions