potiuk commented on PR #22955: URL: https://github.com/apache/airflow/pull/22955#issuecomment-1097927083
> It's a bit sad that we need to have this additional `job_id` variable to keep `mypy` happy, it might be confusing for future contributors. Do you want me to add some additional comment about this in the code? On the bright side - fewer line changes in this PR. I don't find it wrong. It's not to keep mypy happy, it's to make sure you don't accidentally use None. There is nothing wrong with the way you've done and it needs no explanation I think in this case `mypy` gave you hint on how to make your code more redable and less error prone. Contraray to popular belief peeople should optimise their code for easines of reading and correctness not to "Avoid" creating variables. Compileres and interpreters will optimise it away and creating extra, properly named variable is often much better solution than .. adding a comment about it. I often do that. In this case maybe even name it "new_job_id" and even expilcitly mark it as `: str` -> that will be the best "explanation" of what it is for and why it's there. Comments are overrated on the other hand. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
