3 ms·
I understand that some of these suggestions have been made possible by recent changes to Python 3. But how do I know whether a specific change suggestion will g
by justusw 4y ago
I understand that some of these suggestions have been made possible by recent changes to Python 3. But how do I know whether a specific change suggestion will genuinely improve my codebase vs. just confuse Python developers who are used to seeing things implemented a certain way (e.g., Path lib vs open() )? It would certainly make sense to add more information on the tradeoffs and what long term benefits writing it in a certain way will be.
- dosisod 4y agoI agree, better clarification/classification of errors would be nice, as well as the different tradeoffs you should expect from using a particular check. In particular with the Path() related checks, they can seem contrived when used in isolation (open() is a pretty common idiom, like you said), but they become really powerful when you chain them together: (Path("some/deep/folder").parent / "file.txt").read_text() Similar to black, Refurb is opinionated. There are probably going to be checks which you will ignore. Somewhat of a non-goal with Refurb is bringing to light some of the different ways of writing Python code, and the pathlib module is, IMHO, a very underutilized part of the stdlib.
- justusw 4y agoI agree, pathlib is really powerful, and I can see myself using it for new developments. May I then assume that Refurb is better suited to work on new code? To get back to open(), I don’t know if I would want to go through my company’s legacy code (which runs on Python 3.10) and start replacing battle-tested code everywhere. Same would go for tuple literals over lists in certain circumstances. I think this will go really well with choosing an „acceptable“ subset of Python for your project, similar to how some companies choose a subset of C++ and then stick with that throughout a project.
- dosisod 4y agoI think that using Refurb on new projects would be a great use case, but even for existing/old/legacy projects, Refurb can still be a good option, it really just depends on what is already there. I agree that going and updating your company's codebase would probably be a bad idea, considering that there are some kinks here and there. Refurb tries its best, but it is very early on in its development, so errors that are emitted should be taken as suggestions, not gospel.
- BeetleB 4y agoI guess it depends on the time scales people are used to, but Pathlib isn't new. It's been around for 8 years.