Comparison with Named Tuples - Deepstash

Comparison with Named Tuples

Comparison with Named Tuples

Comparison with Named Tuples

  • Dataclasses are by default mutable
  • Named Tuples have methods which start with an underscore which can be confusing. Ex: obj._replace(f=value)
  • Named Tuples have legacy code. Ex: _asdict() returns an OrderedDict
  • Named Tuples can be unpacked
  • Dataclasses are faster at retrieving data but take up more space
  • Dataclasses use functions instead of methods. Ex: asdict() vs nt._asdict()
  • Dataclasses are underlying stored as instance dicts

5

14 reads

It's time to

READ

LIKE

A PRO!

Jump-start your

reading habits

, gather your

knowledge

,

remember what you read

and stay ahead of the crowd!

It takes just 5 minutes a day.


TRY THE DEEPSTASH APP

+2M Installs

4.7 App Score