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

Yeah.

Another rule of thumb is that a lot of the time you can make code that uses tuples clearer by rewriting it to use namedtuple-defined struct values. If the language supported it, it'd probably also make sense most of the time to define a type for each tuple field, and have a type-checker look for errors.

Occasionally you see tuples used where they want immutable and hashable lists, but most of the time they're used as shorthand struct/"pod" tours types.



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

Search: