Git Product home page Git Product logo

immutable-views's People

Contributors

andy-maier avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

immutable-views's Issues

Add hashable support

In case the view classes are used on hashable collections (e.g. frozenset, any of the immutable collection classes on Pypi, nocasedict with the limited hashing support, etc), they should support the __hash__() method and delegate that to the underlying collection, leaving it to that collection to reject the call.

Also, test code should be added that verifies the rejection for non-hashable underlying collections and the success for hashable underlying collections.

Finally, this topic deserves a short section in the docs.

Change testcases for copy() to no longer use protected attributes of view classes

Places in test code that access protected attributes of the View objects:

TBD: What about test DictView()?
test_dict_view.py:1496/1501 - test DictView.copy()
test_list_view.py:230/238 - test ListView()
test_list_view.py:1782/1787 - test ListView.copy()
test_set_view.py:203/210 - test SetView()
test_set_view.py:3334/3339 - test SetView.copy()

Describe relation of DictView to types.MappingProxyType and to dictproxyhack package

Some facts on types.MappingProxyType (as of Python 3.9):

Type annotations

I really like the idea of this library. I could not find any other libraries that provide the same functionality, and I think this is a valuable and somehow unused contribution to the community. However, to provide the same user experience as if using the collections themselves, I think type annotations should be provided. I will try and pick that up, and, if welcome, make a PR some time later.

Clarify inheritance of DictView and ListView

Class DictView currently inherits from abstract class Mapping, but implements the read-only functions of dict which provides some more functions than those of Mapping, so inheriting from dict would be nice, also from a perspective that this would allow using DictView objects where dict objects are declared and checked. On the other hand, DictView does not implement the modifying methods of dict, and inheriting from dict is a statement that it does support all of its methods.

Ditto for ListView, it implements read-only methods from list but inherits from Sequence.

Clarify whether the inheritance should be changed.

Asked the question on the python-list mailing list: https://mail.python.org/pipermail/python-list/2021-April/901876.html

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.