-
Notifications
You must be signed in to change notification settings - Fork 203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Write custom dict-like class to use for features, geometries, and CRS #758
Comments
The part of this work that I was least sure about was warning when users do, for example, |
A dictionary also has a bunch of other methods ( |
@jorisvandenbossche we get those for free when we implement MutableMapping. |
Yes, you get those now from there, but my question is: do you still want those methods in the future if you make the custom Geometry or CRS object? |
We won't implement MutableMapping, only Mapping. So, we'll get keys, values, items, get as mixin methods based on our implementation of iter and getitem. Does that answer your question? Making features immutable is going to break a lot of my own code. But losing dict access would break even more of my own code, which is why I'd like to keep it despite the complications. |
Sorry, I didn't mean to imply losing key access ( Eg if you subclass Mapping instead of MutableMapping, you loose pop, popitem, clear, update, and setdefault. So to rephrase my question: are those properly deprecated in the merged PR? (I suppose so, as they are provided as mixin methods and so are probably implemented in terms of Still inheriting from Mapping indeed gives keys, values, items, get automatically, so that part of my question is answered with that. |
I've added tests to verify that we'll get a warning when calling |
Done! |
This class will raise DeprecationWarnings from its
__setitem__, __setattr__, __instancecheck__, and __subclasscheck__
methods. See https://github.com/Toblerity/fiona-rfc/blob/master/rfc/0001-fiona-2-0-changes.md#considerations.The text was updated successfully, but these errors were encountered: