This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: non-descriptive variable name
Type: enhancement Stage: resolved
Components: Versions: Python 3.7
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: Yuri Kanivetsky, benjamin.peterson, brett.cannon, ncoghlan, terry.reedy, yselivanov
Priority: normal Keywords:

Created on 2017-12-30 01:49 by Yuri Kanivetsky, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (4)
msg309212 - (view) Author: Yuri Kanivetsky (Yuri Kanivetsky) Date: 2017-12-30 01:49
Not a big issue, really. At some point the code switches from "ndots" name:

https://github.com/python/cpython/blob/v3.7.0a3/Python/ast.c#L3385

to "level" name:

https://github.com/python/cpython/blob/v3.7.0a3/Python/Python-ast.c#L1671

Be it "ndots" everywhere, it could save me some time.
msg309520 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-01-05 20:14
'ndots' is an internal name in the import-from branch of the import statement handler.  It seems reasonable in that context.  'level' is part of the public api for the ImportFrom node class, and cannot be changed as such.  It is also the parameter that receives the ndot value in the ImportFrom call, to be assigned to the level attribute.  Making the name switch in the call is at least as reasonable as in the assignment.  I am not the expert here, but I would be inclined to rejected this as not worth the code churn.
msg309537 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2018-01-06 07:08
I would accept a PR to rename the variable in ast.c to "level", but I'm not sure why it should matter to you.
msg309574 - (view) Author: Yuri Kanivetsky (Yuri Kanivetsky) Date: 2018-01-06 20:09
Well, it's just that I was digging into Python's code. And it took me quite a while to figure out what the variable holds. Running into "ndots" name clarified that. That generally means that variable name doesn't describe its content well. But I'm new to Python's code, so it might not be the case. Feel free to close the issue.
History
Date User Action Args
2022-04-11 14:58:56adminsetgithub: 76631
2018-01-06 20:17:33benjamin.petersonsetstatus: open -> closed
resolution: wont fix
stage: resolved
2018-01-06 20:09:55Yuri Kanivetskysetmessages: + msg309574
2018-01-06 07:08:06benjamin.petersonsetmessages: + msg309537
2018-01-05 20:14:32terry.reedysetnosy: + terry.reedy, brett.cannon, ncoghlan, yselivanov, benjamin.peterson
messages: + msg309520
2017-12-30 01:49:41Yuri Kanivetskycreate