-
Notifications
You must be signed in to change notification settings - Fork 3
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
Better support for boolean values #28
Comments
Thanks for pointing it out. That's true that user-friendliness would be improved very much using such approach. However that would be the first time that |
If making exceptions (like I described in my "ideal" case above) is not on the table, would it still be possible to catch the exception from |
Everything is on the table. That would just require significant change of the library's philosophy and I am just looking for additional reasoning behind that.
What would be the better error in this case? |
@thilp Can you provide an example of what error message you would expect here? |
I think the most useful message in my case would have been something like:
as it would have pointed me directly to the source of the error and proposed a fix. I would also have enjoyed a shorter stacktrace because I'm not interested in implementation details.
Imho libraries should strike a balance between happy users and sustainable growth. It is totally fine if Ecological's philosophy is to only support syntactically-valid Python inputs, especially if that leads to a smaller, cleaner codebase, but then I think it restricts a bit its userbase as well: programs relying on it can only be operated by users that are aware of this unusual behavior (which, as far as they are concerned, is an implementation detail). It's not a bad thing, but it leaves an empty space to be filled by e.g. another library wrapping Ecological by translating non-Pythonic user inputs. If the necessary work is small and straightforward, I believe it's simpler (from a purely logistic point of view) to do it in Ecological than building on top of it. |
I am convinced now. Sounds like a good addition. My proposal would be:
What do you think? |
Cool! I think the cleaner error message is definitely a low-hanging and delicious fruit. As discussed offline, I also think that |
@thilp Do you maybe have more ideas what this new parser should tolerate? |
You mentioned lists like |
When specifying
true
instead ofTrue
as a value for an environment variable typed asbool
in Ecological, the program crashes with an obscure error.Expect behavior:
true
(as well asTRUE
and other likely variations) is handled identically toTrue
(and similarly forFalse
);I don't know if this is or should be limited to boolean values.
Replay
$ python3 -m venv /tmp/venv $ source /tmp/venv/bin/activate (venv) $ python3 -m pip install ecological ... Successfully installed ecological-1.6.0
The text was updated successfully, but these errors were encountered: