-
Notifications
You must be signed in to change notification settings - Fork 147
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
PRecord field types in Python 3.7 #181
Comments
Thanks for reporting this. I don't think the initial thought was to put types from the I will have to look more into the inner structure of the types package to be able to provide any guidance on how to solve it. The current suggestion seems fine except for accessing what seems to be meant as private types of the |
I know it's been a while, did you ever have a chance to look at this more? I'm still interested in resolving this if you have any further thoughts on it. |
Hello, I'm also considering Pyrsistent for my project, but not being able to use pmap_fields with Any, AnyStr or other NewTypes could be a dealbreaker... Any thought on how to get around this? |
Although I mentioned at the time I hadn't fully comprehended the implications of my change, looking into things a bit more using As for "workarounds" - in my case
to
Works across a codebase. As for @Gesprye use case - I believe if you define a I guess as a general point, a |
Consider the following code snippet contained in a python module named
pyrsistent_test.py
:When running this under Python 3.6 the output is as follows:
When running this under Python 3.7 the output is as follows:
I've been using the typing module for defining most of my PRecord field types but have only begun to think about upgrading to Python 3.7 hence running into this problem now.
Is it not expected to use things from the typing module when defining the types for a PRecord field - not sure if I've missed another way of doing things?
I do notice that the type of things in the typing module has changed between 3.6 and 3.7:
I did have a go at adding another elif state to maybe_parse_user_type in https://github.com/tobgu/pyrsistent/blob/master/pyrsistent/_checked_types.py#L62-L89 which solved the issue though this doesn't really seem like the right thing to do and I haven't fully comprehended the implications of changing this function!:
Happy to do a PR but feel I would need some guidance first.
The text was updated successfully, but these errors were encountered: