Comparison with Named Tuples - Deepstash
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

21 reads

CURATED FROM

IDEAS CURATED BY

pvl

Ex Backend @deepstash

I started using Dataclasses and I think you should too

The idea is part of this collection:

Machine Learning With Google

Learn more about computerscience with this collection

Understanding machine learning models

Improving data analysis and decision-making

How Google uses logic in machine learning

Related collections

Read & Learn

20x Faster

without
deepstash

with
deepstash

with

deepstash

Personalized microlearning

100+ Learning Journeys

Access to 200,000+ ideas

Access to the mobile app

Unlimited idea saving

Unlimited history

Unlimited listening to ideas

Downloading & offline access

Supercharge your mind with one idea per day

Enter your email and spend 1 minute every day to learn something new.

Email

I agree to receive email updates