Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@bartvm
Copy link
Member

@bartvm bartvm commented Jun 9, 2015

This will at least stop things from crashing, but it'll give warnings as long as the user never imports blocks.extras, which is not ideal. The alternative is to add something like this to config.py:

try:
    import blocks.extras
except ImportError
    pass

But I'm not a big fan of that either

@bartvm bartvm force-pushed the extras-config branch 2 times, most recently from f90c940 to 15b0615 Compare June 9, 2015 00:42
@bartvm bartvm changed the title Load extra config from blocks-extras Prevent blocks-extras config from crashing things Jun 9, 2015
@bartvm
Copy link
Member Author

bartvm commented Jun 11, 2015

@jbornschein @nouiz Here's my proposal for dealing with unknown configurations. It gives a warning, but only if the unknown configuration is a likely typo. Otherwise it just silently ignores it. I prefer this over giving warnings each time a user doesn't import blocks.extras (regardless of whether this warning is given at import or at exit), but it's slightly more user-friendly than being entirely silent.

@nouiz
Copy link
Contributor

nouiz commented Jun 11, 2015

Good direction, but how do you define typo?

On Thu, Jun 11, 2015 at 1:14 PM, Bart van Merriënboer <
[email protected]> wrote:

@jbornschein https://github.com/jbornschein @nouiz
https://github.com/nouiz Here's my proposal for dealing with unknown
configurations. It gives a warning, but only if the unknown configuration
is a likely typo. Otherwise it just silently ignores it. I prefer this over
giving warnings each time a user doesn't import blocks.extras (regardless
of whether this warning is given at imports or at exit), but it's slightly
more user-friendly than being entirely silent.


Reply to this email directly or view it on GitHub
#712 (comment).

@bartvm
Copy link
Member Author

bartvm commented Jun 11, 2015

I use difflib.get_close_matches with the default threshold of 0.6, which is quite sensitive (for example, some_other_backend is a match to log_backend). (Matching with edit-distance might be better, but that's not in the standard library.) For now, that seems to work well, because the few configurations we have are all quite different.

@nouiz
Copy link
Contributor

nouiz commented Jun 11, 2015

This seem good. I didn't know about that lib. I made a ticket in Theano about this: Theano/Theano#3021

@jbornschein
Copy link
Contributor

I guess that works -- it solves the problem. And it uses a stdlib that I didn't know about.

But in general I feel a bit uncanny when it comes to "software wants to be clever about variable or configuration-option names". I think of configuration parsers as simple pieces of software that do something very deterministic and that should not surprise me. And when I ever see a message like "unknown configuration option" I would expect that I will always get such a warning. Not only when the given option is sufficiently similar to an actual option.

According to my judgement I would prefer to simply try to import blocks.extra. And rather deal with the surprises that might pop up as a result of that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants