FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

dynamic PyObject cast required inconsistenly · Issue #86 · pythonnet/pythonnet · GitHub

Repository navigation

dynamic PyObject cast required inconsistenly #86

Closed

Description

I'm passing a float as dynamic PyObject from Python to C# and this kind of assignment is automagically accepted:

double csharpfloat = PythonFunctionReturningFloat();

But when using this PyObject in other numerical operations, then explicit casting is required:

double csharpfloat = 1/(double)PythonFunctionReturningFloat();
double csharpfloat += (double)PythonFunctionReturningFloat();

Any reason for such inconsistent behavior?

Activity

  1. filmor commented on Jun 9, 2020

    Member

    This is probably a shortcoming of C# itself. The first example is an initialisation while the other two examples are expressions.

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


      Back | FazBrowse Home | New Git URL