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

Поделиться
HTML-код
  • Опубликовано: 4 июн 2024
  • Python's @abstractmethod is actually really useful. It helps us keep our code more consistent in certain situations. So let's learn more about it in this Python tutorial!
    ▶ Become job-ready with Python:
    www.indently.io
    ▶ Follow me on Instagram:
    / indentlyreels

Комментарии • 24

  • @EddiKh
    @EddiKh 9 месяцев назад +1

    that moment when you google a topic and you see Indently has a video on it, you know you will understand it quick and easy... many thanks!

  • @jamesford3282
    @jamesford3282 7 месяцев назад +6

    Bro, U shouldn't use "..." for ABC class methods, as I know for ABC U should use "pass", "..." its reserved for Protocols

  • @viktoreidrien7110
    @viktoreidrien7110 Год назад

    great video thank you

  • @rahulnegi456
    @rahulnegi456 Год назад

    Nicely explained

  • @davidl3383
    @davidl3383 Год назад +2

    Excellent thank you. I was looking for that ;) It is the same as Interface in java. You don't herite from, you have to implement them. But the process is the same. Very usefull

    • @Geza_Molnar_
      @Geza_Molnar_ 5 месяцев назад

      Hi, isn't that the 'protocol' that is somewhat like 'interface'?

    • @davidl3383
      @davidl3383 5 месяцев назад

      @@Geza_Molnar_ yes also, .but Principles are thé same. You create an object with empty methods that need to bé filled if you want to use this object

  • @garikisrayelyan1694
    @garikisrayelyan1694 9 дней назад

    Is it correct to use ABC in Django? For example I create a model that I want to be abstract, can I inherit ABC into it so that it becomes impossible to create instances out of it?

  • @eldebtor6973
    @eldebtor6973 2 месяца назад

    abstract classes exists in java but python lacks oop sophistication as it has no access modifiers for classes or class attributes or inheritance specifiers as in this case.

  • @henrijohansson2482
    @henrijohansson2482 4 месяца назад

    Interesting, missed on the fact that the @property notation doesn't cause the function to work like a property in the class that implements the abstract. You actually had to implement the function, but the @property stays there.
    Wait there is more, they occupy the same name space as the properties themselves, but use entirely different syntax. Fascinating
    I wonder can I just implement them with the @property notation as they are

  • @fyks6447
    @fyks6447 Год назад

    Why do we use Abstract class for?

    • @eldebtor6973
      @eldebtor6973 2 месяца назад +1

      to be a dick to your fellow programmers

  • @DrDeuteron
    @DrDeuteron 10 месяцев назад

    maybe mention that abstractproperty and abstractstaticmethod are deprecated.

  • @anonymousPentester
    @anonymousPentester Год назад

    what ide are you using

    • @youngsterdan
      @youngsterdan Год назад

      Thats VS Code afaik

    • @eqac184
      @eqac184 Год назад

      @@youngsterdan lol its pycharm

    • @itsentdev
      @itsentdev Год назад

      No it's pycharm

  • @joxa6119
    @joxa6119 10 месяцев назад +2

    I read a lot on Google about abstraction in Python. Most of it stated that the objective is to hide the information and complexity from the user.
    But I can'r understand and see which part exactly is the "HIDING" part. Can anyone explain this?

    • @sebaperalta2001
      @sebaperalta2001 9 месяцев назад

      The user doesn't need to understand how your code works internally (meaning every line), they just need to know how to use your public classes. Those public classes are abstractions of your private classes that makes the code function.That's my interpretation. Please correct me if I'm wrong or missing something.

  • @user-hq3ni5mk2u
    @user-hq3ni5mk2u 3 месяца назад

    Hahah , ibanana like iapple

  • @PhilippLackner
    @PhilippLackner Год назад +1

    Bro get the camera I'm verified

    • @Indently
      @Indently  Год назад +1

      Bro, you know I can't afford a camera.

    • @mrsquiggles1379
      @mrsquiggles1379 Год назад +1

      Greatest collab in history and nobody's paying attention

  • @codehackery
    @codehackery Год назад

    First