Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use maybe more idiomatic assignment #8215

merged 1 commit into from Aug 28, 2019


Copy link

commented Aug 27, 2019

More clear? Less clear? Not sure...

Copy link

left a comment

Definitely clearer in my eyes. I'm even surprised that the other syntax even exists (declaration without immediate assignment)

Copy link

left a comment

Much clearer. More functional and aligns well with Scala and Python ternary expressions.

If you haven't noticed, I tend on refactoring sprints to make this one of the first changes I do to Python code :) The main reason I like this style is that it makes the intent very clear: "I'm assigning a value based on a certain condition, and nothing else." Rather than "I'm doing something based on these conditions...ends up that I only end up assigning one value, but I could add more statements if I want to!"

@illicitonion illicitonion merged commit df6a2fc into pantsbuild:master Aug 28, 2019

1 check was pending

continuous-integration/travis-ci/pr The Travis CI build is in progress

@illicitonion illicitonion deleted the twitter:dwagnerhall/conditional branch Aug 28, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.