related icon indicating copy to clipboard operation
related copied to clipboard

[WIP] Support any order of arguments

Open GeorgeLubaretsi opened this issue 6 years ago • 3 comments

Proposed solution for #20 for Python 3+

attrs introduced kw_only argument in 18.2.0, which will resolve any incorrect ordering issues, but we'll still need to handle this for Python 2.

@imaurer Can you help me get this PR to the finish line? Also, any proposals for handling this for Python 2?

GeorgeLubaretsi avatar Sep 13 '18 11:09 GeorgeLubaretsi

Cool idea. I need to think about this more when I have some time.

imaurer avatar Oct 13 '18 12:10 imaurer

Hello -- Any updates on this? In general, we should likely expose **kwargs on all field objects. We are mentioning that Related builds off of attrs. Presumably, this implies that we are compatible with attrs. Not having key word arguments on all field methods means that are coupled to a specific functionality set of attrs.

bhargavrpatel avatar Dec 24 '19 01:12 bhargavrpatel

@GeorgeLubaretsi It might be better to simply change the proposed changes to allow callers to explicitly pass kwargs such that we have:

def SequenceField(cls, default=NOTHING, required=True, repr=False, key=None, **kwargs):
    # ...
    return attrib(default=default, converter=converter, validator=validator,
                  repr=repr, metadata=dict(key=key), **kwargs)

bhargavrpatel avatar Dec 24 '19 01:12 bhargavrpatel