-
Notifications
You must be signed in to change notification settings - Fork 407
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
Rewrite OrderedDict
as dict()
#1563
Comments
I think that it'd be good to rewrite most of our OrderedDict usage with dict() since order has been guaranteed since 3.7 (has been on my mental agenda for a while). This one though I'm a bit scared about -- need to look at it more depth after Friday (end of term) -- since it is designed to be manipulated and the order is extremely important. I generally don't put much effort into making doctests etc. work until a python version reaches Beta. (At alpha, I only am concerned about "from music21 import *" works) Since patches and removal have happened in the past. I wish the python team thought more about multi-version doctest maintenance when making changes. |
👍 |
Another potential reason to keep OrderedDict would be in case the dicts ever need to compare unequal if the order differs. So I'll keep an eye out for that as I go. |
I think that we should split this into two issues:
I'll work on the second right now. I'll do what I did on previous cases where the doc test format changed too much (I had a lot of experience with this when we were supporting Python 2 and Python 3 simultaneously). In the initial version, Python 3.12 will ignore the content of OrderedDict doctests; it'll assume that they always work and we'll check the code on Py3.10 and 3.11 runs. Later when Python 3.12 is fully supported and works on all dependencies and has a substantial user base (probably a year from now), I'll swap the logic so that Python 3.11 (and Py3.10 if still music21 supported) assumes that doctests are working and we'll change all the tests to resemble Python 3.12 output. It's a good chance to test that I can still implement a parentheses matching stack taking into account nested and backslashed parentheses. I haven't done that for a bit and code that once did it inside music21 is gone. |
Does enough for this to be Fixes #1563 -- we can change other places as other PRs. @jacobtylerwalls -- can you eyeball this or test it on 3.12? I don't have my test computer where I install Python betas anymore.
music21 version
dev
Problem summary
music21's test suite doesn't pass against the Python 3.12 alphas due to python/cpython#101661.
Example failing test
Expected vs. actual behavior
My first instinct was to suggest:
But then... I realized that the effort could be better spent just rewriting the features to use dict().
We don't seem to be using the features that still make OrderedDict non-obsolete (like
move_to_end()
), but this would have to be checked as part of the work.@mscuthbert what do you think is a better use of maintenance effort? (I'm volunteering to do it...)
The text was updated successfully, but these errors were encountered: