Skip to content
This repository has been archived by the owner on Dec 1, 2021. It is now read-only.

remove unnecessary variable assignments #1070

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lm-noshiro
Copy link
Contributor

@lm-noshiro lm-noshiro commented May 29, 2020

What this patch does to fix the issue.

  • removed unnecessary variable assignments

Link to any relevant issues or pull requests.

#1058

@lm-noshiro lm-noshiro self-assigned this May 29, 2020
@blueoil-butler blueoil-butler bot added the CI: auto-run Run CI automatically label May 29, 2020
@bo-code-review-bot
Copy link

This PR needs Approvals as follows.

  • Ownership Approval for / from iizukak, tkng, ruimashita
  • Readability Approval for Python from tkng, tsawada, tfujiwar

Please choose reviewers and requet reviews!

Click to see how to approve each reviews

You can approve this PR by triggered comments as follows.

  • Approve all reviews requested to you (readability and ownership) and LGTM review
    Approval, LGTM

  • Approve all ownership reviews
    Ownership Approval or OA

  • Approve all readability reviews
    Readability Approval or RA

  • Approve specified review targets

    • Example of Ownership Reviewer of /: Ownership Approval for / or OA for /
    • Example of Readability Reviewer of Python: Readability Approval for Python or RA for Python
  • Approve LGTM review
    LGTM

See all trigger comments

Please replace [Target] to review target

  • Ownership Approval
    • Ownership Approval for [Target]
    • OA for [Target]
    • Ownership Approval
    • OA
    • Approval
  • Readability Approval
    • Readability Approval for [Target]
    • RA for [Target]
    • [Target] Readability Approval
    • [Target] RA
    • Readability Approval
    • RA
    • Approval
  • LGTM
    • LGTM
    • lgtm

@tsawada tsawada removed their request for review May 29, 2020 07:24
@tsawada
Copy link
Contributor

tsawada commented May 29, 2020

To reduce the amount of work on readability reviewers, please send readability review request after you get LGTM and Ownership Approval.

@lm-noshiro
Copy link
Contributor Author

To reduce the amount of work on readability reviewers, please send readability review request after you get LGTM and Ownership Approval.

OK, I understand.

checked_val = lower
return checked_val
def clamp(lower, upper, target):
if target < lower:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about

tmp = max(lower, target)
tmp = min(max, target)
return tmp

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the advantage of this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

less lines and little bit readable.
Umm, but this is my personal opinion.
Not necessary change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about return min(upper, max(lower, target)) ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tfujiwar How do you think about this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about return min(upper, max(lower, target))

I think that's the best way.
In general, reducing conditional branches helps to keep code simpler.

Copy link
Member

@iizukak iizukak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OA

@iizukak iizukak requested a review from tfujiwar June 1, 2020 04:04
elif lower > checked_val:
checked_val = lower
return checked_val
def clamp(lower, upper, target):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


noshiro seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

1 similar comment
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


noshiro seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@iizukak
Copy link
Member

iizukak commented Jul 21, 2020

@lm-noshiro Can you check review comment?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CI: auto-run Run CI automatically low priority
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants