Skip to content

Add support for keyword only arguments #106

@aragilar

Description

@aragilar

There was a suggestion in #38 that there be an option to make arguments keyword only. The suggested API was to have something like:

    @attr.s
    class A:
        a = attr.ib()
        b = attr.ib(init='kwonly')

        # __init__ signature is:
        # def __init__(self, a, *, b):
        #    pass

Would support for this be accepted? What about

    @attr.s(kwonly=True)
    class A:
        a = attr.ib()
        b = attr.ib()

        # __init__ signature is:
        # def __init__(self, *, a, b):
        #    pass

which may be nicer when subclassing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions