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

Fix inaccurate error message #6781

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions klippy/stepper.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,9 @@ def __init__(self, config, need_position_minmax=True,
if (self.position_endstop < self.position_min
or self.position_endstop > self.position_max):
raise config.error(
"position_endstop in section '%s' must be between"
" position_min and position_max" % config.get_name())
"position_endstop in section '%s' must not be outside the range"
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the negative wording is less useful. My personal opinion is that the original wording is better.
"The position_endstop must be between position_min and position_max."

(pick a number between 1 and 10...)

Copy link
Author

@ChasonDeshotel ChasonDeshotel Jan 11, 2025

Choose a reason for hiding this comment

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

There is no rule as to when between can be considered inclusive or exclusive, and the grammatical structure of the relevant sentence would not affect this.

You may be able to make deductions or assumptions from the subject and context of the sentence itself or surrounding sentences, but that would be only assumptions.

If the question of inclusion or exclusion were critical, the only way to determine what was intended would be to ask the author or speaker.

Personally, I would say that very strictly the limits of "between" are exclusive. But you cannot tell how any particular person uses it, and therefore, the only appropriate answer to your question is: "If in doubt, ask!"

Addendum (post-acceptance): The fact that "between" is strictly exclusive of the limits can be illustrated by considering its use when referring to physical objects. For example, you might refer to:

the gap/space between two parked vehicles
the path between the river and the road

In such cases the 'limits' are the vehicles, river and road: "between" does not include the vehicles, river or road, but refers only to the 'area' within those 'limits', namely the gap/space or path.
Likewise, "between 1 and 10" excludes the 'limits' 1 and 10, and includes only the 'items within those limits, namely 2 to 9.

source: https://english.stackexchange.com/a/118403

And here we're talking about the gap/space between two points. This is almost certainly the reason I subconsciously used the exclusive between

I'm not sure there's a right or wrong answer here, and even if there were there's enough confusion around the topic that the only wording that makes sense for everybody is to just explicitly state that it's inclusive

If you'd said "The position_endstop must be a number between position_min and position_max", I'm almost certain I would have used inclusive but my brain would spawn off a thread wondering why such a sophisticated codebase built around mathematics decided to go with the term "numbers" 😅

" specified by position_min and position_max."
% config.get_name())
# Homing mechanics
self.homing_speed = config.getfloat('homing_speed', 5.0, above=0.)
self.second_homing_speed = config.getfloat(
Expand Down