8 ms·
Recently I had to port some code from the legacy version of an internal DSL to our newer version. I just wrote a primitive parser that would understand 98% perc
by archi42 7y ago
Recently I had to port some code from the legacy version of an internal DSL to our newer version. I just wrote a primitive parser that would understand 98% percent of the code (in a safe way) and lowered that into the new DSL. Worked like a charm, and I didn't have to rewrite ~2000000 lines (a colleague tried pattern matching, but that was unusable for complex expressions).
I wonder if/why there is no such ~~thing~~ [edit] effort for python2/3?
If you're only accepting programs that P2 accepts, you can even get away with being lazy and "understanding" more than P2.
- Izkata 7y agoThis isn't from experience (I have yet to do a conversion myself), but one thing I've heard is that the str/unicode change revealed that a lot of codebases didn't understand the difference in py2, were using the wrong one at API boundaries, and required a lot of manual work to figure out what it should be for each one so py3 could handle it.
- archi42 7y agoOuch. GP mentioned int/float conversion differences, and coders using the wrong [string/unicode] types doesn't help. I wonder if these are symptoms of duck typing? Edit: 2to3 is what I'm talking about https://docs.python.org/2/library/2to3.html https://docs.python.org/2/library/2to3.html