@@remi1771 He claims himself as to be a tutor and then goes to upload videos where he doesn't even link the documentation which is utterly crucial in this field. `dataclasses` module in Python is not just to get rid of some boilerplate code. `dataclass` has vast variety of optional arguments which can be useful, `dataclasses` module also includes various functions; in none of his videos that I've seen has he ever told his viewers to have a look at the documentation to learn more; most of his viewers are beginners who are not tech geek by the age of four or something. This practice forces these beginners to be depended on these creators to learn some "hidden & forbidden genjutsu" about Python as indirectly claimed by the utterance of these gormless creators.
@@eeriemyxi agreed, these ‘tutorials’ are really only useful for intermediate programmers who are looking for some ideas and know to look up the api immediately afterwards
@Patrick Lenihan I have done couple modifications to the comment that you should consider reading. > _He summarised "dataclasses" as boilerplate reduction which is a correct summary of what it is._ `dataclasses` itself is a module, it is not some function that helps to reduce boilerplate code, rather it includes various functions and the function that helps with boilerplate code. > _Your claim that Python is its own field_ IT IS its own field, you might want to revise your definitions. > _that it belongs to tech geeks who have been programming from 4 years old is less passable_ That was never my claim, that's your skeptical speculation. > _Python is a tool that is useful to many types of people from many fields._ Many fields? What are these fields? What are you talking about? There's only one field and that's programming. Python is a programming language, not some math specific tool or someone's sex tool. Whenever you make use of a programming language, you are supposed to read what the creators of the programming langauge per se wants you to pore over-not some idiot on RUclips. You are supposed to read the documention and not _solely_ depend on some moron to learn more of Python. This gormless tutor never told his viewers to have a look at the documentation to learn more of any topic, which is very crucial in this field.
@@AnEnemyAnemone1 calm done. Seems like you’ve never coded before. You don’t need to understand everything you see, however unrelated, to work on something.
On large screens, YT places the mute button under the like button so you can never press it and hear the video. All you can do is repeatedly like/dislike. Good job Google!
You know, the best way I found to learn python was to just do it. Pick a project or topic that interests you and learn as you go. Learning the theory is great and all but you can read every book and still struggle to put it into practice. Don’t fall for the crash courses or the expensive books. Learn by doing, it’s the best education you can get. Good luck my fellow nerds!
@@prasoondhapola2875 It's better to avoid shorts like this too; don't ever trust anyone on RUclips and expect good content from them when it comes to Programming; _most_ of the time, you will be misguided. However, there are exceptions e.g mCoding, and such channels are quite rare.
Well we can use better options (not alternatives) like Pydantic for such use-cases, although I won't say Pydantic Baseclass would be the alternative for Python dataclasses
but this is not clear because sometimes there are variables that are bound to the class' parameters when instantiating, but some are not. And I would prefer the old longing way to create a class with initial attributes under the init dunder method
@@derMulti26 Pick a visual conception video on OOP which does what the title say: explain you the concept of OOP; then seek the official tutorial of Python to learn the syntax.
@@endgamez7621 If you happen to be writing some super efficient code for some very complex task where C could be used but you chose Python, you will then feel the slowness.
@@endgamez7621 C is a very useful language but modern Python has so much C or Rust or whatever that's running behind the scenes that for a lot of purposes, Python is faster to write and fast *enough*.
nice short BTW, namedtuple also can do the same job for you, use it like this from collections import namedtuple Person = namedtuple("Person", ("name", "age"))
A rare example of genuinely good advice from this guy
and even then, it's far from being a passable video when we read the documentation of `dataclasses` module.
@@eeriemyxi care to elaborate?
@@remi1771 He claims himself as to be a tutor and then goes to upload videos where he doesn't even link the documentation which is utterly crucial in this field.
`dataclasses` module in Python is not just to get rid of some boilerplate code. `dataclass` has vast variety of optional arguments which can be useful, `dataclasses` module also includes various functions; in none of his videos that I've seen has he ever told his viewers to have a look at the documentation to learn more; most of his viewers are beginners who are not tech geek by the age of four or something. This practice forces these beginners to be depended on these creators to learn some "hidden & forbidden genjutsu" about Python as indirectly claimed by the utterance of these gormless creators.
@@eeriemyxi agreed, these ‘tutorials’ are really only useful for intermediate programmers who are looking for some ideas and know to look up the api immediately afterwards
@Patrick Lenihan I have done couple modifications to the comment that you should consider reading.
> _He summarised "dataclasses" as boilerplate reduction which is a correct summary of what it is._
`dataclasses` itself is a module, it is not some function that helps to reduce boilerplate code, rather it includes various functions and the function that helps with boilerplate code.
> _Your claim that Python is its own field_
IT IS its own field, you might want to revise your definitions.
> _that it belongs to tech geeks who have been programming from 4 years old is less passable_
That was never my claim, that's your skeptical speculation.
> _Python is a tool that is useful to many types of people from many fields._
Many fields? What are these fields? What are you talking about? There's only one field and that's programming. Python is a programming language, not some math specific tool or someone's sex tool.
Whenever you make use of a programming language, you are supposed to read what the creators of the programming langauge per se wants you to pore over-not some idiot on RUclips. You are supposed to read the documention and not _solely_ depend on some moron to learn more of Python.
This gormless tutor never told his viewers to have a look at the documentation to learn more of any topic, which is very crucial in this field.
Haha thank you, I see these at work but never got around to fully understanding them
lol, what do you at work where you’d see these but not understand something as simple as this?
@@AnEnemyAnemone1 calm done. Seems like you’ve never coded before. You don’t need to understand everything you see, however unrelated, to work on something.
@@madhououinkyoma no hes right, you and op are morons
데이터클래스의 단점은 멤버 변수가 많아질 때임
객체를 생성할 때 헷갈릴 수 있다는 점에 유의해야 함
Can you add custom methods to them like you normally would?
Probably not, I think the intent here is simply to simplify the process of making classes with nothing but data stored in them
@dataclass just add few methods to your class, like a __init__, so you have a completly normal class, you can to define methods, etc
Of course. If not then this would be useless
What's the catch?
Why would need to compare object if they are equal
thx
Nice, just like Java Records!
yeah
This breaks the magic of OOP
Why?
That will be awesome if you make a loong tutorial about
_init_.next()
@@PerteTotale 🤔
King of python ❤
You're watching and learning Python from the wrong source then.
Why learn python right now if AI will replace python Developers faster than any other language?
C#: record Person(string name, int age);
Or we can just use a dict or tuple instead of a class
lol, python devs first time see decorators))))
On large screens, YT places the mute button under the like button so you can never press it and hear the video. All you can do is repeatedly like/dislike. Good job Google!
This is a wonderful feature . I have recently used it too.
man!!! you're awesome. Love your shorts.
It's important to talk about __post_init__ because real code WILL need it, dataclass cannot do all the __init__ most times.
if you think classes in any programming language are awesome means you still haven’t learned anything about programming besides propaganda
Arjan Codes uses them a lot. Since I learned from them and their tricks it's true that the code is much more simpler and easier to read.
If I subclass Person, will repr() say Person or type(self)?
I don’t understand why you’re not just using pydantic.
when you hear the nasal voice and then the face and you wait to spot some silly code or advice... but I think this time no?!
Your content is great you are just a tad too loud. Try talking in a slightly calmer voice maybe.
Not use classes and you can bypass all that junk too, oh wait I am thinking of C
Still can’t get how all these @ decorators working under the hood 😢
Why is python always strange, data types are usually on the left side :/
So are there any situations where you wouldn't want to use a data class?
That's why c++ and kotlin are awesome
You know, the best way I found to learn python was to just do it. Pick a project or topic that interests you and learn as you go. Learning the theory is great and all but you can read every book and still struggle to put it into practice. Don’t fall for the crash courses or the expensive books. Learn by doing, it’s the best education you can get.
Good luck my fellow nerds!
So are these basically like a struct in C/C++?
@AllargsConstructor in Java 😮
Lombok not native Java
Why didnt it print the Secound one
what is that theme ur using
time to shove this into my next .py file in school
Please make dsa full course in python please🙏
Lombok is here😅
love shorts like this
Name of theme ?
Which theme u are using
Wtf is this lol
helium?
Great
Niice, but what if there are two string attributes in the class. How does Python allot them, is it based on order of declaration?
dec dataclass has also eq and sort meths
🤯Brilliant. As a python noob this was mind-blowing for me. More shorts like this please 🙏🙏🙏🙏
Learn to do without this first. You'll be able to read and understand it better I hope
@@patelaa86 yeah it's best to avoid shortcuts in the beginning right
@@prasoondhapola2875 It's better to avoid shorts like this too; don't ever trust anyone on RUclips and expect good content from them when it comes to Programming; _most_ of the time, you will be misguided. However, there are exceptions e.g mCoding, and such channels are quite rare.
@@eeriemyxi Corey Schaefer the GOAT
Well we can use better options (not alternatives) like Pydantic for such use-cases, although I won't say Pydantic Baseclass would be the alternative for Python dataclasses
but this is not clear because sometimes there are variables that are bound to the class' parameters when instantiating, but some are not. And I would prefer the old longing way to create a class with initial attributes under the init dunder method
Is it hackerrank problem for python day4 ? :D
tldr a data class is the Python version of records in Java
Interesting, like project lombock for Java
Are you Swedish? Please tell me, I'm dying. ;(
Why do you guys use OOP if you still use data structures?
It's the equivalent to Lombok library in Java
too much sugar.
That's the Zen of Python.
@@eeriemyxi now I love data classes.
@@DrDeuteron I don't get it. Did you bookmark my comment to reply it a year later?
@@eeriemyxi no, the algo does repeats.
And in the mean time I got space data files with 247 attributes.
which theme?
Looks like jellyfish
Not jellyfish
@@vinayakdumbre2828 its not jellyfish. do you know?
@@rp7814 could be tokyonight or catppuccin
Awesomeness
sana masarap ulam mo. salamat
That’s cool
eyy nice i just started learning OOP in python
Soundd great, can u recommend some resources (youtube channels or books) for OOP in python?
@@derMulti26 Pick a visual conception video on OOP which does what the title say: explain you the concept of OOP; then seek the official tutorial of Python to learn the syntax.
Thank you, i didn't know this.
How is the dataclass decorator implemented?
Like C# records
This is awesome atleast coming from c sharp the data class decorator is easier to grasp
Pretty good
I thought print calls __str__ and __repl__ is called by the interactive interpreter
You right. But If str doesn’t overload print calls repr
Great for creating anemic object which are an antipattern by themself.
i mean wouldn't this work well in MVC? it's useful to have data and logic separated sometimes
This works with a list too?
this is awesome !!
Can you use them instead in all situations?
dataclass vs pydantic BaseModel ?
Data Class are extremely slow, they implement most if not all magic methods. Be careful with that. You may want to just you regular classes sometimes.
how slow?
@@endgamez7621 If you happen to be writing some super efficient code for some very complex task where C could be used but you chose Python, you will then feel the slowness.
@@eeriemyxi so should one learn C instead
@@endgamez7621 Depends.
@@endgamez7621 C is a very useful language but modern Python has so much C or Rust or whatever that's running behind the scenes that for a lot of purposes, Python is faster to write and fast *enough*.
That's awesome
They’re just ok
I thought print calls __str__ and __repl__ is called by the interactive interpreter
str() calls repr() if __str__ doesn't exist
@@schlopping Really?? So I can just implement repr() only and be done with it? Does it work the other way, __str__() only?
Thy
Which python version was it introduced?
3.7
Awesome insights
Yay!
nice short
BTW, namedtuple also can do the same job for you, use it like this
from collections import namedtuple
Person = namedtuple("Person", ("name", "age"))
That is insane. Python is insanely good .
Probably copied from swift
@@thepoorsultan5112 Python steals from C.
@@SHONNER well python [cpython] is written in c so ...
@@thepoorsultan5112 And C is a rip-off of...
WOW!!
just like Lombok?
Yes
Wat
Thanks I knew it but often forget to use it
But less undrestandable
Not when you understand meta classes, decorators, and, most importantly, OOP.
You're a legend!
Amazing!
It turns OOP into Predefined Object Oriented Programming, which is shit.
I don't like them. We don't need 100 ways to do everything. Just makes everything more complex for minor visual thing, not worth
Read the documention, then you will feel and see the worth of this module.
@@eeriemyxi xD
Thanks for it👍🏻
This is disgusting syntax just use c#