jacebrowning / datafiles

A file-based ORM for Python dataclasses.
https://datafiles.readthedocs.io
MIT License
198 stars 18 forks source link

Optional self in patterns, no configuration option required #293

Closed bnorick closed 1 year ago

bnorick commented 1 year ago

Here's what I envisioned, no additional configuration option is required and both selfless and selfish patterns are supported.

bnorick commented 1 year ago

Thoughts?

jacebrowning commented 1 year ago

@bnorick Thanks for submitting the PR for review! At this time I'm not planning to merge it. It's more code than I'd like to maintain for what amounts to saving a a few characters.

I really appreciate the other contributions you've made to this project! :v:

bnorick commented 1 year ago

I guess I'll have to code golf it then 🤣

bnorick commented 1 year ago

It seems pretty minimal already, to be honest, and it doesn't seem to me that it would need any maintenance. If you won't accept this sort of PR because you don't think it matters then that's fine, just let me know.

But just look at "/path/to/root/{key}/{subkey}.toml" vs"/path/to/root/{self.key}/{self.subkey}.toml" :rofl:

jacebrowning commented 1 year ago

I don't think avoiding the need for the self. prefix is a big concern right now, but thanks for the proposal!