Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Python classes are basically dictionaries that have a distinct type bound to them. Alternatively you can subclass from dictionary to give yourself a distinct type but still be a dictionary. Slotted classes are basically named tuples (and of course, Python has actual named tuples and dataclasses), so there's a lot of ways to "tag" a collection with a specific type in mind.


A typed dict is more like what I mean. Obviously I know about classes as I'm no stranger to OO.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: