Skip to content

Suggestion: Separate Python functions/classes from C-based code #109

@RobertoRoos

Description

@RobertoRoos

I wanted to suggest splitting the Python interface from the C-based code. Something like:

# hid.py

class Device:
    # Regular Python class

    def read():
        # Regular Python method
        hid_ex.read()  # Use C-based function, generated from Cython
# hid_ex.pyx

def read(int ....):
    # Cython function

Advantages:

  • Documentation can be generated automatically (hid_ex could be simply mocked)
  • User IDEs have full code completion / suggestions, since they interface with regular (and by now well-documented) Python
  • Development is made a little easier a recompile is not always necessary

Disadvantages:

  • Speed or performance might be affected, though I'm sure not about it - Functionality remains in C-based Library, only an extra interface is added

I'm curious what you think.

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