Re: Python dataclass equivalent

2022-01-21 Thread Kovas Palunas
Thanks for the detailed response! I like the idea of using destructuring to be more specific about what data a function expects. I also think the pre/post conditions with spec would mostly solve my problem. I think I'm still getting used to spec's syntax, which feels fairly verbose to me when def

Re: Python dataclass equivalent

2022-01-20 Thread James Reeves
Type hints in Clojure have a different purpose to those in Python. In Clojure, type hints are only a mechanism to avoid reflection; their use is solely to improve performance. So the question "Can I use spec as a type hint?" is actually asking "Will the compiler use specs to avoid reflection?",

Python dataclass equivalent

2022-01-20 Thread Kovas Palunas
Hi all, Coming from python, I use dataclasses a lot to tie complex collections of data together. I like using them in combination with type hints so that it's clearer to me at a glance what kind of data a function is processing. When my dat