Been using dataclasses more and more for my trading projects. Wondering what the cleanest pattern is for a dataclass that has an Enum field — specifically when serializing to JSON. Do you manually call .value or is there a cleaner approach?
I've been writing Python scripts for a while now. Nothing crazy, just automating small stuff, scraping some data, making my life a little easier. I thought I had a decent handle on things.
I was looking at someone else's code and they used a list comprehension in a way that made me stop and read it three times. I realized I had been writing loops the long way this whole time not because I didn't know list comprehensions existed but because I never really trusted myself to read them when I wrote them fast. I kept defaulting to the for loop because at least I could trace it line by line without second-guessing myself.
I don't know if this is a common thing but I feel like there's a version of learning where you know a concept exists, you've seen it work, you've even used it a few times, but you haven't actually internalized it. You're kind of faking fluency in that little area. I was doing that with list comprehensions, with zip, with a few other things I won't list here because it's already embarrassing enough.
Once I wrote out ten examples by hand tonight it clicked in a way it hadn't before even though I'd "learned" this two years ago.
Anyone else have a concept they thought they understood for a long time before actually understanding it?
I've been learning Python the last couple weeks, just a little bit here and there. I understand the basics but I'm hitting a wall with OOP. I've been having Claude create lessons for me, but nothing is sticking. What do you guys do to help retain information better on this?