-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Options for valid method #9
Comments
Yes, this is probably a good idea. Should the coordination number be I feel it will be a breaking change if we set it to not be included as default, as is have been "active"by default since implementation. |
We shouldn't break anything so coordination number should be true by default. It's also a valid personnummer :) |
After some discussion on slack, we'll add this v3 of the spec. #15
Example
ping @Johannestegner |
I first posted this in #15, but I'll delete the other comment and move the discussion here. Regarding accepting an object as a second parameter. Can this be language-specific? Or at least do not implement this in the Python package? For example, the following two functions, def foo(param1, param2=False, param3=True):
pass
def bar(param1, **kwargs):
param2 = kwargs.get('param2', False)
param3 = kwargs.get('params3', True) And both can be used like so: foo('foobar')
foo('foobar', param3=False)
foo('foobar', param2=True)
foo('foobar', param3=False, param2=True)
bar('foobar')
bar('foobar', param3=False)
bar('foobar', param3=False, param2=True)
params = { 'param2': True, 'param3': False }
foo('foobar', **params)
bar('foobar', **params)
foo('foobar', param4=False) # Raises an error for an unexpected keyword argument
bar('foobar', param4=False) # No error, but `param4` will just be ignored. But only foo('foobar', True, False)
bar('foobar', True, False) # This raises an error |
First of all I will say thank you to your great comment about how this works in python and giving us input about language-specifics issues. We have had a discussion about this and to allow language-specific code for both options and how errors are handeld. We will up the spec document and #15 about all that we decided about what v3 should contain. |
Version 3 of the spec allows to create language specific options and error handling. The aren't so much options left in version 3 either since we removed the coordination number option and replaced it with a class method. https://github.com/personnummer/meta#package-specification-v3 |
We should add a options to
valid
method to disable coordination number as discussed in personnummer/python#5Something like this:
We should also update the package specification readme.md
ping @Johannestegner
The text was updated successfully, but these errors were encountered: