osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Python-Dev] Policy on refactoring/clean up


On 26.06.2018 12:00, Jeroen Demeyer wrote:
> Hello,
>
> On https://github.com/python/cpython/pull/7909 I encountered friction 
> for a PR which I expected to be uncontroversial: it just moves some 
> code without changing any functionality.
>
> So basically my question is: is there some CPython policy *against* 
> refactoring code to make it easier to read and write? (Note that I'm 
> not talking about pure style issues here)
>
> Background: cpython has a source file "call.c" (introduced in 
> https://github.com/python/cpython/pull/12) but the corresponding 
> declarations are split over several .h files. While working on PEP 
> 580, I found this slightly confusing. I decided that it would make 
> more sense to group all these declarations in a new file "call.h". 
> That's what PR 7909 does. In my opinion, the resulting code is easier 
> to read. It also defines a clear place for declarations of future 
> functionality added to "call.c" (for example, if we add a public API 
> for FASTCALL). Finally, I added/clarified a few comments.
>
> I expected the PR to be either ignored or accepted. However, I 
> received a negative reaction from Inada Naoki on it.
>
> I don't mind closing the PR and keeping the status quo if there is a 
> general agreement. However, I'm afraid that a future reviewer of PEP 
> 580 might say "your includes are a mess" and he will be right.
>
AFAICS, your PR is not a strict improvement, that's the reason for the 
"friction".
You may suggest it as a supplemental PR to PEP 580. Or even a part of 
it, but since the changes are controversial, better make the 
refactorings into separate commits so they can be rolled back separately 
if needed.

>
> Jeroen.
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: 
> https://mail.python.org/mailman/options/python-dev/vano%40mail.mipt.ru

-- 
Regards,
Ivan