How To Use: "@dataclass" In Python (Tutorial 2023)

  Рет қаралды 29,800

Indently

Indently

Күн бұрын

Пікірлер: 33
@thepackbot
@thepackbot Жыл бұрын
That tidbit about "variables with default values must come after the ones without them", just explained a big problem I was having. Thank you!
@pankuang-q1k
@pankuang-q1k 8 ай бұрын
your explaination is very helpful for understanding the question 'why we need to do that ', and i like your explaination for reading a json file to an object. Thank you very much for this good video.
@FrocketGaming
@FrocketGaming 6 ай бұрын
Thanks for this. As I was watching and working on a selenium web scraping script I realized I could make a config dataclass to store all the css_selectors / xpaths I need for this script!
@mecrayavcin
@mecrayavcin 4 ай бұрын
Nice video
@kostasmessinis
@kostasmessinis 9 ай бұрын
good
@davidl3383
@davidl3383 Жыл бұрын
Thank you. Very clear like your udemy couse ;)
@chromery
@chromery Жыл бұрын
Great video as always! Have you by any chance made a video about Pydantic (couldn't find it), or are you maybe planning to?
@velicihanates3288
@velicihanates3288 Жыл бұрын
You could have used two asterix operators to insert json in your person class 'bob = Person(**json)'
@Indently
@Indently Жыл бұрын
Only if your dataclass fits PERFECTLY the data from the JSON, otherwise it will throw an error.
@velicihanates3288
@velicihanates3288 Жыл бұрын
@@Indently thanks for telling, I really enjoy your python tutorials!
@thepackbot
@thepackbot Жыл бұрын
that's called unpacking.
@kamurashev
@kamurashev Жыл бұрын
Nice! Named tuple vs dataclass for the next video?
@Indently
@Indently Жыл бұрын
Possibly someday!
@forethiocodingstaff
@forethiocodingstaff Жыл бұрын
Young, energetic python developer
@enricoroselino7557
@enricoroselino7557 Жыл бұрын
bob job nice
@smanzoli
@smanzoli Ай бұрын
It's important to talk about __post_init__ because real code WILL need it, dataclass cannot do all the __init__ most times.
@MrGeordiejon
@MrGeordiejon 26 күн бұрын
bob = Person(**json) print(bob) >>> Person(name='Bob', age='30', job='Salesman', friends=['Mario', 'Luigi'])
@jeyosman1
@jeyosman1 8 ай бұрын
I just wanted to take a moment to express my sincere appreciation for your exceptional explanations and the engaging speed at which you communicate. Your clarity and enthusiasm truly stand out, making learning from you an absolute pleasure. Thank you for your dedication and talent-I genuinely admire the way you convey information
@MathewGuest
@MathewGuest 29 күн бұрын
How do data classes compare to pydantic third-party library?
@NoidoDev
@NoidoDev Жыл бұрын
Is it better to use that for data or some dict? For example, It seem that I won't be able to get "keywords". Also, there's a difference between __slots__ and slots=True, which is that you can use default value with the new method.
@aryandatla5188
@aryandatla5188 2 ай бұрын
can we implement linked lists using dataclass?
@SanwicklithMkalinga-g6h
@SanwicklithMkalinga-g6h Жыл бұрын
Do u have a course… or mentoring program
@Indently
@Indently Жыл бұрын
I have a couple of courses at: indently.io
@losco_arti
@losco_arti Жыл бұрын
Cool. Thanks!
@superyngo
@superyngo 11 күн бұрын
why not using **json as arguments?
@DrDeuteron
@DrDeuteron Жыл бұрын
Don't forget the dataclasses.Field object...can be very useful when dealing with telemetry. There's also the "astuple" method that is attached to the class.
@nargileh1
@nargileh1 4 ай бұрын
bob = Person(json['name'],json['age'],json['job'],json['friends']) why not use this instead? bob = Person(**json)
@lostsoul8634
@lostsoul8634 Жыл бұрын
I'm learning python... bob= Person(**json) is better?
@MathewGuest
@MathewGuest 29 күн бұрын
That is a good way to do it. If the data structures ever go out of sync, they would need updated
@betapacket
@betapacket Жыл бұрын
5th
@Timmie_Tudor
@Timmie_Tudor Жыл бұрын
Why are you teaching people how to use me?
@Indently
@Indently Жыл бұрын
Because you're great and deserve to be treated with respect.
@developer_anonymous
@developer_anonymous Жыл бұрын
'banana.calories = 69, i mean, 60' 😂
How To Use: "@abstractmethod" In Python (Tutorial 2023)
8:01
10 Neat Ways To Use Underscore In Python
18:17
Indently
Рет қаралды 23 М.
Happy birthday to you by Secret Vlog
00:12
Secret Vlog
Рет қаралды 6 МЛН
Симбу закрыли дома?! 🔒 #симба #симбочка #арти
00:41
Симбочка Пимпочка
Рет қаралды 4 МЛН
How Much Tape To Stop A Lamborghini?
00:15
MrBeast
Рет қаралды 204 МЛН
Data Classes in Python Are The New Standard
20:34
NeuralNine
Рет қаралды 67 М.
Python dataclasses will save you HOURS, also featuring attrs
8:50
10 Nooby Mistakes Devs Often Make In Python
24:31
Indently
Рет қаралды 67 М.
Python Inheritance & Polymorphism (OOP - Part 2)
14:31
Code with Gunnar
Рет қаралды 432
Attrs, Pydantic, or Python Data Classes?
17:10
ArjanCodes
Рет қаралды 87 М.
Python Data Classes Are AMAZING! Here's Why
16:11
Tech With Tim
Рет қаралды 85 М.
Modern Graphical User Interfaces in Python
11:12
NeuralNine
Рет қаралды 1,6 МЛН
5 Tips For Object-Oriented Programming Done Well - In Python
16:08
This Is Why Python Data Classes Are Awesome
22:19
ArjanCodes
Рет қаралды 815 М.
5 Awful Python Mistakes To Avoid
22:13
Indently
Рет қаралды 27 М.
Happy birthday to you by Secret Vlog
00:12
Secret Vlog
Рет қаралды 6 МЛН