Closed Themanwithoutaplan closed 4 years ago
The idea was to import the Exceptions from fritzconnection.core.exceptions
to top level so that users of the package can address exceptions like from fritzconnection import FritzServiceError
etc.
So basically this is about masking the core
namespace? The top-level namespace should contain the things users need directly.
I'd suggest simply fritzconnection.exceptions
as the proper place for them and possibly an __all__
definition for a "safe" from fritzconnection.exceptions import *
It's not about masking, it's just for convenience. fritzconnection.exceptions
would be also ok for me. An __all__
definition may be a good idea in case someone uses a *
import (which I really discourage).
I think we should be explicit here. I'm not sure that client generally wants the exceptions and, if your editor does autocompletion, getting FritzConnection is a challenge? ;-)
import *
is there because it's useful.
„Usefulness“ does not prevent it from being disliked by me ;-)
„Usefulness“ does not prevent it from being disliked by me ;-)
Of course not, which is why I suggested __all__
. I'll see if I can do this week. NB. docs look like they might need updating.
Yes, docs represent the 0.x versions.
Removing most of the shortcut imports it looks better now. Also not harder to use. 993da135e857dc147bb9db578f6a74d3778da8ab
An __all__
is also included now e7cc5456412ca8b6dcb482f91876760c302b8104
docs are also updated now. So I like to close this.
The exceptions are are in the top-level namespace of the package. This obviously for a reason but I find it unusual and sightly confusing.