Skip to content

Implement dict views objects #84

Description

@OutSquareCapital

Currently we have the ABCs views (keys, values, items), and we use them to opaquely wrap PyDict.

It works! but, this is:

  • suboptimal => we use PyObject functions instead of highly optimized PyDict ones)
  • error prone => due to the fact that ABCs views and dict views do NOT have the same behavior).

However the C API surrounding views is a bit clunky and currently VERY limited in pyo3, so we should first of all choose if we:

A) Implement "from scratch" the views in pyclass, directly wrapping a PyDict.
B) Wrap the corresponding views objects.

B is vastly preferable due to better consistency with the rest of the codebase and much easier maintenance, but due to the aforementionned clunky C API this is not a straightforward a decision than other collections.

Moreover, the "1 parent class" only force us to first of all refactorize the rust codebase as a whole to consistently use py_abc proc macro to enforce traits and reduce code duplication, to avoid painfully reimplementing ALL the methods by hand again.

Activity

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

    featureA new feature (not an enhancement!)need discussion/reflexionYet to decide architectural-level changesperformanceperformance-improvement enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions