ericvsmith / dataclasses

Apache License 2.0
587 stars 53 forks source link

Common protocol with attrs? #65

Closed ericvsmith closed 6 years ago

ericvsmith commented 7 years ago

As discussed in #52, is there any way that dataclasses and attrs could share a protocol that would make things like serialization easily shareable between them?

hynek commented 7 years ago

Can you be more specific about what you had in mind?

ericvsmith commented 7 years ago

It came from suggestion on that thread that maybe there could be a way to detect that something is a dataclass/attrs instance, and use common code for serialization (asdict(), astuple(), etc.). I think it started here: https://github.com/ericvsmith/dataclasses/pull/52#issuecomment-344320706.

ericvsmith commented 6 years ago

I can't come up with any use case for this (or even how it would work), so I'm closing this.