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

Поделиться
HTML-код
  • Опубликовано: 28 ноя 2024

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

  • @EddiKh
    @EddiKh Год назад +3

    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 Год назад +9

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

  • @garikisrayelyan1694
    @garikisrayelyan1694 6 месяцев назад

    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 8 месяцев назад

    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.

  • @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_ 11 месяцев назад

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

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

      @@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

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

    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

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

    great video thank you

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

    Why do we use Abstract class for?

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

      to be a dick to your fellow programmers

    • @AINeverDies
      @AINeverDies 3 месяца назад

      To teach it, my dear, to teach it.

  • @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

  • @derekreed6798
    @derekreed6798 3 месяца назад

    Isn't iBanana.__init__ and the super() call redundant code?

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

      No, because what the
      super().__init__(model)
      line does is call the constructor of the super class, so that the iBanna's object will do everything a Phone object does upon construction. Which is why we don't have to set self.model to model like in the Phone's __init__ constructor.

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

    maybe mention that abstractproperty and abstractstaticmethod are deprecated.

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

    what ide are you using

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

      Thats VS Code afaik

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

      @@deltaheiwa lol its pycharm

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

      No it's pycharm

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

      @@itsentdev ity pycharm ye

  • @joxa6119
    @joxa6119 Год назад +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 Год назад

      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.

  • @alexmark-u4d
    @alexmark-u4d 9 месяцев назад

    Hahah , ibanana like iapple

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

    First