Skip to content
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

attr.ib(order) function key #624

Closed
graingert opened this issue Feb 14, 2020 · 4 comments
Closed

attr.ib(order) function key #624

graingert opened this issue Feb 14, 2020 · 4 comments
Labels

Comments

@graingert
Copy link
Contributor

eg:

import attr
import natsort

_natsort_key = natsort.natsort_keygen()

class Ham:
    name = attr.ib(order=_natsort_key)
    id = attr.ib()
@gabbard
Copy link
Member

gabbard commented Feb 14, 2020

Is the request here that if you have:

import attr
import natsort

_natsort_key = natsort.natsort_keygen()

@attrs(cmp=True)
class Ham:
    name = attr.ib(order=_natsort_key)
    id = attr.ib()

then the generated comparison functions should treat that attribute as if _natsort_key had been appplied to it first?

@gabbard
Copy link
Member

gabbard commented Feb 14, 2020

This seems potentially related to #435

@botant
Copy link
Contributor

botant commented Feb 14, 2020

I agree that this seems like something that could be handled as part of #435.

I'm working on it now, and I'll check if the proposed solution can accommodate this use case in a natural/intuitive way.

@hynek
Copy link
Member

hynek commented May 5, 2021

I believe this is fixed by #787. Please scream/re-open if not!

@hynek hynek closed this as completed May 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants