Discover and read the best of Twitter Threads about #pythontutorial

Most recents (1)

Do you know #Python "Data Classes"

They are a great Python feature that can help you write less code

🧵Let's find out more👇
1️⃣ dataclass decorator adds generated methods
- __init__
- __repr__
- __eq__

to the class and returns the same class it was given. This module provides a deco...
2️⃣ Generated __init__ method takes all fields as function parameters. Their values are set to instance attributes with the same names.

Fields are defined as type annotated class attributes.

For example, you can define User with fields id and name.👇 A dataclass is a Python mod...
Read 9 tweets

Related hashtags

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3.00/month or $30.00/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!