Idea how to clean up the parameter list of validate_email[_or_fail] #57
Replies: 3 comments 2 replies
-
I think you have a lot of free time on your hands :) Good! Putting the options into a set is not a good idea, as the order of the values within are not preserved in python3.7 and below (I think), but a The unification of the argument names is a good idea in general imo, just to make the API a bit more straightforward. That said, it will be a major module version change, as it will contain breaking changes: i.e. |
Beta Was this translation helpful? Give feedback.
-
Ah I think I missed the point that the values for the variables are unique integers and thus the order doesn't matter. In that case, using a |
Beta Was this translation helpful? Give feedback.
-
Now as we've decided to not have parameters about whether or not to raise exceptions, I think it's okay to keep separate parameters for the 4 checks that can be enabled or disabled. However, I think with the major release, the parameter list could still be cleaned up:
All of the above are just ideas, but as it might probably be quite some time until the next change to clean up the public interface, it might be worth considering what can be done now. |
Beta Was this translation helpful? Give feedback.
-
With the growing number of checks that can be switched on and off, the parameter list has become somewhat long and cluttered, switches are named
use_*
,check_*
, orskip_*
, and also some have to be set toTrue
to enable a test, some toTrue
to disable the test.I had the idea of replacing all these parameters with a single one:
First, we define a constant for each of the possible checks:
and we define the default set of checks as a Python
set
:Then, we can change
validate_email_or_fail
to accept the parameterchecks: Set = CHECK_DEFAULT
.Downside: this would either break compatibility with previous versions, or we'd have to accept both options for a while, adding a deprecation warning when the old parameters are used.
What do you think?
Beta Was this translation helpful? Give feedback.
All reactions