Python dataclasses will save you HOURS, also featuring attrs

แชร์
ฝัง
  • เผยแพร่เมื่อ 20 พ.ย. 2024

ความคิดเห็น • 854

  • @patrickjdarrow
    @patrickjdarrow 3 ปีที่แล้ว +2650

    A "Production Python Code" course by you would be a hit. These are the things I never picked up as a mostly self taught programmer. Great stuff.

    • @mCoding
      @mCoding  3 ปีที่แล้ว +308

      Thanks!

    • @logankillen2669
      @logankillen2669 3 ปีที่แล้ว +62

      I also think this would be cool, but would be hard not making it too long while staying informative. It seems like many TH-cam channels favor having a 5 hour crash course. Beginners don’t have the attention span (imo) because they’ll have so many questions.

    • @johnr3936
      @johnr3936 3 ปีที่แล้ว +200

      @@logankillen2669 this isn't beginner content, it's intermediate content for programmers who want to improve.

    • @johnnybarrett3445
      @johnnybarrett3445 3 ปีที่แล้ว +161

      @@johnr3936 which are the hardest tutorials to find!

    • @flowers134
      @flowers134 3 ปีที่แล้ว +46

      This would be actually what I need ! Focus on real world professional prduction-code. Either to be better qualified for a job or to particiapate in big projects like pandas, numpy etc.

  • @eoghainlebioda1396
    @eoghainlebioda1396 3 ปีที่แล้ว +1249

    I love that you show WHY you would want to use this rather than just what it is. It really drives home the actual usefulness of this

    • @mCoding
      @mCoding  3 ปีที่แล้ว +163

      I think that's what's really the important part.

    • @AlexGb007
      @AlexGb007 3 ปีที่แล้ว +16

      Totally agree! Happy TH-cam recommend me your channel!

    • @parryhotter18
      @parryhotter18 2 ปีที่แล้ว +6

      Thanks! The WHY is the part that is missing almost everywhere else. Subscribed and hoping for more :-)

    • @jeffreyhunter4115
      @jeffreyhunter4115 2 ปีที่แล้ว +2

      Agree 100%

    • @QuintinMassey
      @QuintinMassey ปีที่แล้ว

      Agreed! Context matters.

  • @octopirate-bak
    @octopirate-bak 2 ปีที่แล้ว +183

    Update: as of python 3.10, slots are now supported in in-built dataclasses with the ``slots`` argument

    • @msatul1305
      @msatul1305 10 หลายเดือนก่อน

      what is that?

  • @zishiwu7757
    @zishiwu7757 3 ปีที่แล้ว +83

    Thank you for this valuable video! Before watching your video, I assumed dataclasses were just a Python version of C structs, for cases where you didn't want to add functions in a class but didn't want a raw tuple either. After watching your video, I learned that dataclasses are much more sophisticated than that.

    • @mCoding
      @mCoding  3 ปีที่แล้ว +9

      Glad it was helpful!

  • @dhanushkari9042
    @dhanushkari9042 3 ปีที่แล้ว +63

    I have been looking for such tutorials (unique less known concepts for intermediate programmers) for years now. This channel is an absolute gem!
    Great work James!

    • @mCoding
      @mCoding  3 ปีที่แล้ว +5

      Thanks so much for your kind words!

  • @vnpikachu4627
    @vnpikachu4627 3 ปีที่แล้ว +31

    I love the way you start by explaining and go to the solutions. Most people just start by showing what it does and how to do it, without ever mentioning why we really need it. Keep going, your style of teaching will reach millions of people.

  • @DSCuber
    @DSCuber 2 ปีที่แล้ว +73

    I don't think my jaw has ever dropped from a coding video before. The beauty of being an engineer is you learn something new every day. So much hidden utility in python its amazing!

  • @usharma1624
    @usharma1624 3 ปีที่แล้ว +154

    I'll remember this. I don't know much about OOP so I didn't understand much. When I'll learn, I'll re-watch this video.

    • @mCoding
      @mCoding  3 ปีที่แล้ว +38

      You don't need to know about OOP to understand classes! You are simply making your own class that holds an int and a str!

    • @vandelayindustries2971
      @vandelayindustries2971 3 ปีที่แล้ว +24

      @@mCoding Classes are the very basics of OOP. If you don't know about OOP, chances are you don't know how classes work either.

    • @mCoding
      @mCoding  3 ปีที่แล้ว +35

      You definitely need classes for OOP, but classes can be used for other programming paradigms besides OOP, though I guess you are right in that usually classes are introduced in the context of OOP.

    • @usharma1624
      @usharma1624 3 ปีที่แล้ว +4

      @@mCoding Yeah, I have seen classes used in programs, where no OOP was involved. In those programs, classes were used just to pack data into one structure. However, I've not seen @property, __hash__, or how to make them immutable so I thought they were covered in OOP.

    • @TheHippyHoppyHippo
      @TheHippyHoppyHippo 3 ปีที่แล้ว +2

      I strongly recommend that you learn Python and OOP immediately.

  • @taylormallory8705
    @taylormallory8705 2 ปีที่แล้ว +2

    About 2 years ago I came over from writing bare C to having Python as my daily driver. I've grown to really enjoy the language. 95% of the time it suits my needs and videos like this just illustrate how absolutely brilliant it can be. Thanks for the new trick up my sleeve!!!

  • @xavierdingeldein9336
    @xavierdingeldein9336 3 ปีที่แล้ว +7

    As someone who has been slowly getting into the nitty gritty of writing classes, this video was informative, scary, and then relieving. Not only have you showed me what I have yet to learn, but also why it's something that should understood, but hopefully never written.

  • @nicke20686
    @nicke20686 3 ปีที่แล้ว +215

    Best Python videos on youtube. Or maybe most valuable? Covering so many useful and unique topics no one else seems to.

    • @mCoding
      @mCoding  3 ปีที่แล้ว +23

      Wow, thanks!

    • @gagik1
      @gagik1 3 ปีที่แล้ว +3

      @@mCoding thank you very much for your videos. I know something new every video.

  • @kylefluto5384
    @kylefluto5384 3 ปีที่แล้ว +226

    I'm starting to realize how damn useful class and method decorators are. I have the cumbersome Learning Python book by Orielly but these videos offer a lot of value due to how terse they are. @cache and @dataclass all day baby

    • @mCoding
      @mCoding  3 ปีที่แล้ว +53

      Books actually contain a lot of useful stuff! Lucky for me I love reading terse literature (high signal-to-noise-ratio).

    • @maltml
      @maltml 3 ปีที่แล้ว +16

      ​@@mCoding Do you have some book recommendations?

    • @s.i.m.c.a
      @s.i.m.c.a 3 ปีที่แล้ว +10

      @@maltml the human brain tend to work in a way - that if you didn't use it, you will forgot it....thus reading the book without goal is just a waste of time. Better to lvl the skill in ability to search for information you actually needed and when you need it.
      It's like - i'm watching this vid; yep cool stuff, standard lib. But if you would have a hundreds of classes, transforming each via class decorator would eat performance on module load.

    • @narnbrez
      @narnbrez 3 ปีที่แล้ว

      don't diss lutz ;p

  • @stratfanstl
    @stratfanstl 2 ปีที่แล้ว +7

    I have just started experimenting with Python to use animation libraries from Grant Sanderson / 3Blue1Brown and have seen your videos pop up. Your organization and presentation of these tips is great for both initial learning and reference. Very concise, straightforward examples without cryptic foo / bar based variables, etc. New subscriber!

  • @addvert_br0009
    @addvert_br0009 3 ปีที่แล้ว +17

    This is actually one of the best CS-related channels I've watched

    • @aa-nw8hk
      @aa-nw8hk 3 ปีที่แล้ว

      But its not c sharp, its python

    • @addvert_br0009
      @addvert_br0009 3 ปีที่แล้ว +9

      @@aa-nw8hk CS = computer science

  • @lordtejas9659
    @lordtejas9659 3 ปีที่แล้ว +3

    **Note: As of Python 3.10 data classes DO support slots.**
    Thanks for adding it to the description, this video is gold!

    • @mCoding
      @mCoding  3 ปีที่แล้ว +1

      Of course! Thanks for watching!

    • @lordtejas9659
      @lordtejas9659 3 ปีที่แล้ว

      @@mCoding It's been 3 hours and I am still watching your videos! I was just watching another video!

    • @mCoding
      @mCoding  3 ปีที่แล้ว +1

      👏😮 that means a lot, thanks! Glad you enjoy my videos so much!

  • @dgnikon
    @dgnikon 3 ปีที่แล้ว +13

    I love that you called out the issue with __slots__
    The default dict instance representation has turned my implentation into a massive memory hog, tuple instance representation fixed that!
    Maybe __slots__ and other memory optimization and profiling techniques could be the topic of a future video!

    • @mCoding
      @mCoding  3 ปีที่แล้ว +2

      I'll cover slots eventually, but that's a more technical topic!

    • @Avicenna697
      @Avicenna697 3 ปีที่แล้ว

      I think NamedTuple from typing module used slots by default. Also seem to work with @property.

    • @lawrencedoliveiro9104
      @lawrencedoliveiro9104 3 ปีที่แล้ว

      I use slots to avoid typos. Particularly important if your class has writable properties.

    • @omgwtfafterparty
      @omgwtfafterparty 2 ปีที่แล้ว

      as for now, slots are available in dataclasses too (since python 3.10)

  • @carlesg0n
    @carlesg0n 3 ปีที่แล้ว +3

    Best video on dataclasses I have ever seen by far. Loved the approach of firstly doiny an example implementation, then showing the issues found, and finally solving them using the feature displayed.

    • @mCoding
      @mCoding  3 ปีที่แล้ว

      Awesome, thank you!

  • @bettercalldelta
    @bettercalldelta 3 ปีที่แล้ว

    What makes this video really useful is thay you show why you need it rather than what does it do.

  • @Julie9009
    @Julie9009 3 ปีที่แล้ว +3

    Thank you for introducing me to dataclasses! Using a dataclass has just considerably simplified a module that I'm working on right now.

  • @ciberman
    @ciberman 2 ปีที่แล้ว +1

    C# dev here learning python for my Software Engineering thesis. I love your videos, directly to the point and with a lot of useful information!

  • @drooten
    @drooten 3 ปีที่แล้ว +1

    Well explained without sounding fancy. It's one of the reasons I like your videos: you know how to get to the point.

  • @richardchin1545
    @richardchin1545 2 ปีที่แล้ว +2

    Seen a few Python dataclasses videos but this one is the clearest and most informative in a short time. Well done!

  • @d8-remy
    @d8-remy 3 ปีที่แล้ว +5

    This is the type of stuff classes should teach. I really appreciate your content.

  • @grahamjoss4643
    @grahamjoss4643 3 ปีที่แล้ว +22

    Cool functionality. Thanks for sharing
    @ 3:32 the dead pan to the camera... Lol !
    Love the dry humor

    • @mCoding
      @mCoding  3 ปีที่แล้ว +13

      I will slowly dial up the humor moving forward.

    • @mustafamotiwala2335
      @mustafamotiwala2335 3 ปีที่แล้ว

      @@mCoding its absolutely perfect the way it is!

    • @reformed_attempt_1
      @reformed_attempt_1 3 ปีที่แล้ว +1

      3:30

  • @mrdbourke
    @mrdbourke 3 ปีที่แล้ว +20

    Wow, this is an outstanding video! Thank you so much. I just found out you’ve got a Python course, I’m in

  • @therzook
    @therzook 3 ปีที่แล้ว +1

    as a beginner with some basic knowledge it is the content I started peeking in, some professional stuff that I can learn actually makes life much easier!

    • @mCoding
      @mCoding  3 ปีที่แล้ว

      Glad to peel back the curtain for you!

  • @amirh6712
    @amirh6712 3 ปีที่แล้ว +4

    So basically this is python's equivalent of lombok's @Data annotation in java and python supports this out of box
    Thanks for sharing it
    Your videos are amazing. You always get to the point without wasting any time

    • @mCoding
      @mCoding  3 ปีที่แล้ว +1

      Thanks for such kind words!

  • @TheSkyCries1
    @TheSkyCries1 3 ปีที่แล้ว +2

    I remember doing project for school in java where the professor didn't let you use any libraries, so if you wanted something to be comparable you had to type every thing out... my God. This brings tears to me eyes that dataclasses in pyton will automatically do all of that for you.

    • @ABaumstumpf
      @ABaumstumpf 3 ปีที่แล้ว +1

      Well - the professor did the right thing - get you to actually use the language.

  • @LittlePharma
    @LittlePharma 3 ปีที่แล้ว +3

    Highly recommend checking out pydantic. It's a huge extension to normal dataclasses, adding serialisation, better validators, forced typing and more!

    • @mCoding
      @mCoding  3 ปีที่แล้ว

      I'll check it out! Thanks for the suggestion.

  • @AnyFactor
    @AnyFactor 3 ปีที่แล้ว +164

    The new mic has arrived!

    • @mCoding
      @mCoding  3 ปีที่แล้ว +32

      Indeed it has! Let me know if the audio quality sounds good or if I've messed something up!

    • @Wiedzmin940
      @Wiedzmin940 3 ปีที่แล้ว +8

      @@mCoding its perfect :)

    • @deViant14
      @deViant14 3 ปีที่แล้ว +5

      It sounds much better. Though it sounds like there's a little bit of reverb somehow

    • @toktik7576
      @toktik7576 3 ปีที่แล้ว +2

      @@mCoding Your voice sounds perfect, but you can hear some vibrations from keyboard sounds in the audio

    • @mCoding
      @mCoding  3 ปีที่แล้ว +11

      I actually left typing noises in on purpose because they sound satisfying... not sure if others agree or would rather not hear me clicking and clacking.

  • @ChasmChaos
    @ChasmChaos 3 ปีที่แล้ว

    Your videos are extremely information rich, yet not "dense" in terms of accessibility of the ideas.

  • @bartugonulalan
    @bartugonulalan 3 ปีที่แล้ว +3

    LMAO That pause and eye contact after he read "I just subscribed". I FELT THE PRESSURE MAN!

    • @mCoding
      @mCoding  3 ปีที่แล้ว +1

      :D subliminal messaging

  • @ropro9817
    @ropro9817 3 ปีที่แล้ว +2

    These are really great videos! I'm just learning Python for work and they're extremely helpful with simple and clear explanations.

  • @kelkka7
    @kelkka7 3 ปีที่แล้ว +4

    This is great! You do a great job of explaining these features. I always found classes to be annoying to deal with in Python and have stayed away from OOP because of that, but this approach might change my mind.

  • @icen9ne645
    @icen9ne645 3 ปีที่แล้ว +2

    To get the nice syntax using the `attrs` library, use `auto_attribs=True` in the decorator and you'll be able to get the same syntax ability of mixed defaults in `dataclass`.

  • @constantfear
    @constantfear 3 ปีที่แล้ว

    When I first came across decorators and understood that the dectaror takes the function or class as an argument, I thought this will have so many uses. Data classes are gold

  • @paologhezzo4276
    @paologhezzo4276 3 ปีที่แล้ว

    This is the perfect intermediate to advanced python concepts I would like to see covered in a single comprehensive course. Your explanations are very punctual and I seem to really get a lot out of your videos. I am glad I found this channel. You should really consider, as others have suggested, to make such a course.

    • @mCoding
      @mCoding  3 ปีที่แล้ว

      Noted!

  • @anirangoncalvesbr
    @anirangoncalvesbr 3 ปีที่แล้ว +1

    Dataclasses are a beautiful idea, and hearing "There's gotta be a better way!" reminds me of Sir Raymond's classes. Great stuff 👍!

  • @schneeekind
    @schneeekind 3 ปีที่แล้ว

    I am watching all your videos since a random youtube recommendation. Some of the best coding videos I have seen yet, very clear, easy to follow and often about topics and features I would never thought that I will benefit from. Thanks!

    • @mCoding
      @mCoding  3 ปีที่แล้ว

      Great to hear!

  • @williambos4410
    @williambos4410 3 ปีที่แล้ว +2

    Subbed to this channel at like 300 subs and now 2 weeks later you're at 12.3k. you're going places my dude, keep it up, great content

    • @mCoding
      @mCoding  3 ปีที่แล้ว +1

      Appreciate it!

  • @Khushpich
    @Khushpich 3 ปีที่แล้ว

    I've being doing python for a while now and a lot of things here are new to me. Thanks for making this

    • @mCoding
      @mCoding  3 ปีที่แล้ว

      Glad it was helpful!

  • @thiamath
    @thiamath 3 ปีที่แล้ว +5

    This video gave me goosebumps...
    This feat is amazing!!!
    Great video! Very succint and useful!

    • @mCoding
      @mCoding  3 ปีที่แล้ว

      Thank you so much!

  • @vaishantsah
    @vaishantsah 9 หลายเดือนก่อน

    I am way too noob for this video but I'll watch it whole and watch it again after 6 months. Thanks!

  • @aidanfarhi367
    @aidanfarhi367 3 ปีที่แล้ว +3

    Very cool. I can see this saving alot of time. Python never ceases to surprise me

    • @mCoding
      @mCoding  3 ปีที่แล้ว +1

      I know it saves me a lot of time!

  • @jacksonyan7346
    @jacksonyan7346 3 ปีที่แล้ว +1

    Ey this is cool. My college classes made me design my own cpu but never actually taught me any useful stuff like this.

    • @SimGunther
      @SimGunther 3 ปีที่แล้ว

      Both of those things are actually useful. Sucks that your college only taught you the former.

  • @Chrisdashes
    @Chrisdashes 2 ปีที่แล้ว

    The fact that I was lost 10 seconds in is a testament, I need to get back to this. I'mma just save this to the list. (30-40 hrs into learning python)

  • @HubertRozmarynowski
    @HubertRozmarynowski 2 ปีที่แล้ว

    Thanks for putting the time and effort to explain dataclasses thoroughly. You're the best!!

  • @mmartel
    @mmartel 3 ปีที่แล้ว +1

    Thanks for shining a spotlight on these very useful Python modules with a good, concise tutorial. Great comparison between attrs and dataclasses, too.

  • @raymondzhao5644
    @raymondzhao5644 3 ปีที่แล้ว +1

    Wow, I commented and asked for a dataclass vid a week ago and you actually delivered. Nice :)

    • @mCoding
      @mCoding  3 ปีที่แล้ว +1

      Hope you enjoyed it!

  • @2Sor2Fig
    @2Sor2Fig 3 ปีที่แล้ว

    Really liked this. I'm building a library for Kivy-based apps that provides an interface for working with TastyPie on a Django-based server, and this is exactly what I need for storing information related to each model schema exposed through the API. So much simpler and readable. Always good to learn more about Python, thanks for the vid!

  • @loveUbleach4ever
    @loveUbleach4ever ปีที่แล้ว

    I took CS in bachelors, CS in masters and have PhD but never have I crossed this, thanks a lot man, this is actually pretty helpful. it shows how dumb down the CS degrees are right now, No one is doing any code and doing shit that is outdated and have no real life usage.

  • @2fritazz
    @2fritazz 3 ปีที่แล้ว +11

    U got me with the “I just subscribed “ look lolol

  • @mujeebishaque
    @mujeebishaque 3 ปีที่แล้ว

    This is the first video I've watched on this channel. I love this guy! Great work!

    • @mCoding
      @mCoding  3 ปีที่แล้ว +1

      Wow, thanks!

  • @kychemclass5850
    @kychemclass5850 2 ปีที่แล้ว

    Higher than my current level, but when I get there, this will be even fantastic. THANK YOU !!!! :D

  • @smanzoli
    @smanzoli หลายเดือนก่อน +2

    It's important to talk about __post_init__ because real code WILL need it, dataclass cannot do all the __init__ most times.

  • @acecabezon
    @acecabezon 9 หลายเดือนก่อน

    I really like your style of videos and have watched most of them already. But I'll admit I'm not sold on dataclasses... With your first example, you know exactly what python will do in each use case. With dataclasses, you've wrapped your code with an opaque magic cloak that you can either simply hope that it does what you want, or you will have to test every corner of its behavior, or analyze all the corners of the dataclass code itself. And newer coders will not understand it -- I know because someone at my work uses them and even after explaining them to me I had no clue what he was talking about or what they did, and I've been writing python for 10 years.

  • @cosmicpuma1409
    @cosmicpuma1409 3 ปีที่แล้ว +1

    3m30... That is the new Deathstare!! Awesome, Subbed. Great vid and Mitch appreciated.

  • @zd4w9
    @zd4w9 9 หลายเดือนก่อน

    I'm a beginner, but I started using data classes more ad more just because it was easier to keep things organized and understandable.

  • @aliin_daglicht
    @aliin_daglicht 3 ปีที่แล้ว

    James u deserve an award for being the greatest python teacher of all the time! the PYTHON GOAT

    • @mCoding
      @mCoding  3 ปีที่แล้ว +1

      Wow thank you for the praise!

  • @ethanperry8
    @ethanperry8 3 ปีที่แล้ว +2

    Your vids are the perfect thing for me, I usually get lost in long videos. Yours are short, simple and actually demonstrate applications of it

    • @mCoding
      @mCoding  3 ปีที่แล้ว

      Great to hear!

  • @datenschauer
    @datenschauer 2 ปีที่แล้ว

    Wow. After this video I think I really got the gist of Python dataclasses. And so many ideas popped up in my head to refactor some code. Thanks a lot! 😃

  • @myaccount6216
    @myaccount6216 2 ปีที่แล้ว +14

    I have no idea what's happening

  • @JohnZakaria
    @JohnZakaria 3 ปีที่แล้ว +3

    You never fail to amuse me.
    Didn't know that fields thing

    • @mCoding
      @mCoding  3 ปีที่แล้ว

      Thx!

  • @siberx4
    @siberx4 3 ปีที่แล้ว

    If your use-case requires more capability than dataclasses can provide, I highly recommend looking into pydantic instead of attrs. We switched from attrs to pydantic in a project of ours that makes heavy use of these dataclass-like patterns for things like packet handling, and pydantic has been a huge step up from attrs. It has much more powerful validation mechanisms, cleaner and less quirky syntax, integrates very nicely with typing and provides a lot of useful mechanisms for generating objects from data you receive remotely (say as JSON) rather than creating them yourself, or that you need to transmit to other external services/components. It even has built-in support for automatically generating JSON schemas from the pydantic classes, which can make it much easier to provide a machine API for interfacing with your classes or generate a GUI using something like json-editor.

  • @tiiibo
    @tiiibo 2 ปีที่แล้ว +1

    that little pause at 3:30 made me subscribe 😂

  • @WhyNotProgram
    @WhyNotProgram ปีที่แล้ว

    Good intermediate YT content is hard to come by, subbed! Amazing post 😁

  • @rafael.beirigo
    @rafael.beirigo 2 ปีที่แล้ว

    Amazing video, love it! (loved the "hinting eye contact" @ 3:30 ;)

  • @DarkWizard316
    @DarkWizard316 2 ปีที่แล้ว

    HOLY SHIT. Why didn't I just learn this ages ago? It's fantastic!

  • @seasong7655
    @seasong7655 ปีที่แล้ว

    I've just used these for my users in flask. Great explanation

  • @fahimulislam7331
    @fahimulislam7331 3 ปีที่แล้ว +1

    3:31 the pause and cold look after "I just subscribed" :D

    • @mCoding
      @mCoding  3 ปีที่แล้ว

      😇

  • @stevecarter8810
    @stevecarter8810 3 ปีที่แล้ว

    Most valuable 9 minutes of my python career

    • @mCoding
      @mCoding  3 ปีที่แล้ว

      Thanks for the kind words!

  • @dominikprager5338
    @dominikprager5338 3 ปีที่แล้ว

    That 3:29 was hillariously sneaky! Good video btw

  • @jonasking3670
    @jonasking3670 3 ปีที่แล้ว +19

    I shouldn’t watch this so close to going to sleep. This is going to give me weird dreams.

    • @mCoding
      @mCoding  3 ปีที่แล้ว +7

      I will try my best to not appear in your dreams.

    • @Kenionatus
      @Kenionatus 3 ปีที่แล้ว

      I heard learning before going to bed is efficient because you'll process what you learned in your sleep. Source: Idk, probably read it in the morning.

  • @thatguy6664
    @thatguy6664 3 ปีที่แล้ว

    One of the best Python OOP videos I've ever seen. Thanks!!

    • @mCoding
      @mCoding  3 ปีที่แล้ว

      Glad it was helpful!

  • @DrDemolition
    @DrDemolition 2 ปีที่แล้ว

    This channel is a goldmine.

    • @mCoding
      @mCoding  2 ปีที่แล้ว +1

      Many thanks! I appreciate your kind words.

  • @yash1152
    @yash1152 ปีที่แล้ว

    7:33 attrs allow u to specify validators & converters
    wholly molly, thats awesome and exactly what i needed.

    • @yash1152
      @yash1152 ปีที่แล้ว

      u earned a sub - i guess this is first video of u i am actually watching
      youtube pushed other vids before, but never got time

  • @richardme123
    @richardme123 3 ปีที่แล้ว

    This is really cool and I just learned that you can put decorators on classes :) thank you!! You have earned yourself a subscriber.

    • @mCoding
      @mCoding  3 ปีที่แล้ว +1

      Thanks for subbing!

  • @luandasilva4639
    @luandasilva4639 3 ปีที่แล้ว +1

    The *slaps table* is very important in the "There has to be a better way."

    • @mCoding
      @mCoding  3 ปีที่แล้ว

      I'll do this in the future :)

  • @anonyme103
    @anonyme103 3 ปีที่แล้ว

    Apart from the amazing video, you're acting skills are on point :D

  • @kasta867
    @kasta867 3 ปีที่แล้ว

    What a nice and clear explanation! I will try to implement this in my thesis project!

    • @mCoding
      @mCoding  3 ปีที่แล้ว

      Go for it!

  • @anupamdash1102
    @anupamdash1102 3 ปีที่แล้ว

    *You* my friend are the new Cory Schafer! Thank you for contributing to free education :D

  • @sanmeetsingh4538
    @sanmeetsingh4538 2 ปีที่แล้ว

    That was soo awesome .. I saved a lot of time writing code for json responses ! Really awesome stuff 😁

  • @michaelmueller9635
    @michaelmueller9635 ปีที่แล้ว +1

    For dataclasses, there is direct support for __slots__ (added to python in 3.10). Just as an update.

  • @alvincruz8296
    @alvincruz8296 3 ปีที่แล้ว

    My search is over, @dataclass put me in a whole new level.

  • @travel.tales.official
    @travel.tales.official 6 หลายเดือนก่อน

    Subscribed. Really great one. Will be following more of yours tutorials.

  • @cawinchan4282
    @cawinchan4282 3 ปีที่แล้ว +1

    Great stuff man! Im new to the channel but I've already learnt a lot from your videos! Keep churning out these high quality content!! :D

    • @mCoding
      @mCoding  3 ปีที่แล้ว

      Thanks! Will do!

  • @atakanyenelalumni27
    @atakanyenelalumni27 3 ปีที่แล้ว +1

    I didnt know this so thanks for the video. One thing I missed was the speed comparison. You made the Manual class larger by giving the performance as an excuse(not equal and all sorting methods) but when discussing dataclass you never mentioned the performance overhead. The size of the code probably justifies it’s slower anyways but its not mentioned :(

    • @mCoding
      @mCoding  3 ปีที่แล้ว

      Performance overhead is it probably 3x's to 10x's most operations. If you are going for pure speed, you may want to avoid wrapper classes and just use tuples. (See my video on how fast python's sort it, I compare tuple vs dataclass speed there). However, the vast majority of code is not limited by the operations you do on class objects, so for most code the impact would be minimal.

  • @johnnybarrett3445
    @johnnybarrett3445 3 ปีที่แล้ว

    Insanely clear and valuable tutorials dude! Subbed in a millisecond

    • @mCoding
      @mCoding  3 ปีที่แล้ว

      Hey, thanks!

  • @rikschaaf
    @rikschaaf 3 ปีที่แล้ว

    This is basically like lombok's @Data and @Value for java. Nice stuff!

  • @cubbyhoo
    @cubbyhoo 3 ปีที่แล้ว

    Omg I just finished a Python OOP assesment at uni, where was this library! (I am also just stupidly happy I understood this video)
    I had all these issues so I will be using this in the future. Thanks so much, keep up the great work!

    • @mCoding
      @mCoding  3 ปีที่แล้ว +1

      Glad I could help!

  • @FR33Willi
    @FR33Willi 3 ปีที่แล้ว

    you just explained private vs public attributes in like 5 seconds, something that i didnt understand after years of coding lol

  • @ahmd09
    @ahmd09 3 ปีที่แล้ว +1

    The medic channel for self-taught devs

  • @fartzy
    @fartzy 2 ปีที่แล้ว

    wow bro this is amazing. Thanks for doing what you do man!

  • @samtoya
    @samtoya 3 ปีที่แล้ว

    I'm hooked to this course bro, a huge thanks for this.

    • @mCoding
      @mCoding  3 ปีที่แล้ว

      No problem 👍

  • @dogukan463
    @dogukan463 3 ปีที่แล้ว

    When he read the comment "I just subscribed" and looked at the camera I immediately gave in.

    • @mCoding
      @mCoding  3 ปีที่แล้ว

      Ty ty you've fallen for my tricks

  • @franferri
    @franferri 3 ปีที่แล้ว

    I'm adding a second comment. This vid taught me more useful stuff in 8 mins than any other I remember ever before in that time.

    • @mCoding
      @mCoding  3 ปีที่แล้ว

      Wow! Awesome!

  • @otesunki
    @otesunki 3 ปีที่แล้ว

    WHAAAAAA
    THIS HELPS SOOO MUCH WITH MY AST NODES
    THANK YOU SO MUCH

    • @mCoding
      @mCoding  3 ปีที่แล้ว +1

      You are very welcome 😊

  • @roniabraham9602
    @roniabraham9602 2 ปีที่แล้ว

    You have a very deep insight into the python source code

  • @tassoskat8623
    @tassoskat8623 3 ปีที่แล้ว

    Great video! Rare material in TH-cam. Thank you!

    • @mCoding
      @mCoding  3 ปีที่แล้ว +1

      Glad you enjoyed it!

  • @MarkJay
    @MarkJay 3 ปีที่แล้ว

    Never heard of dataclasses. They look super useful! BTW, I really like your channel.

    • @mCoding
      @mCoding  3 ปีที่แล้ว

      Awesome, thank you!