Why Everyone is always Talking About Duck Typing in Python.

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 ก.พ. 2025
  • What is duck typing? And what is the difference with static typing? In this video you get the answer to that question and as a bonus you will see how to give your objects superpowers by implementing magic methods.
    ENROLL OR PREVIEW THE FULL COURSE:
    🎓 PYTHON DATA MODEL - SPECIAL METHODS IN CLASSES: pythonforevery...
    C H A P T E R S
    0:30 Duck typing example
    2:00 Difference with statically typed languages
    3:05 Benefits of duck typing
    4:10 Type compatibility without formal interfaces
    5:20 Combining duck typing and magic methods
    #pythonforeveryone #ducktyping #python

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

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

    Great explanation! Thanks

  • @aldolunabueno2634
    @aldolunabueno2634 7 หลายเดือนก่อน

    The pythonic way is so cool. Thanks.

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

    can you make a video on piping concept used for project delivery

    • @python-for-everyone
      @python-for-everyone  ปีที่แล้ว

      Do you mean like a build pipeline and continuous delivery?

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

      @@python-for-everyone yes you got me right 🫂💕

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

    Suppose you need to use a 3rd party library's method which requires a object duck. but you have no idea what methods this duck object need to have. In your test it might run ok, but for other it might raise an error!

    • @python-for-everyone
      @python-for-everyone  9 หลายเดือนก่อน

      Libraries might expect your objects to support certain special methods. An example is Django's dataclass, that will use your object's __str__. But it is unlikely that 3d party libraries will expect arbitrary methods where there is no fallback on a baseclass implementation.

  • @PriYa-jm2vf
    @PriYa-jm2vf ปีที่แล้ว

    Tamil la teach pannunga sir

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

      ivanga foriegn la irukaanga ivangaluku tamil la theriyathu

    • @coolguy-zm7tn
      @coolguy-zm7tn 8 หลายเดือนก่อน +1

      Where do these mofos come from😂😂

    • @coolguy-zm7tn
      @coolguy-zm7tn 8 หลายเดือนก่อน +1

      Tamil shut has gotten to your head, eff u nd ur dmk leaders, they are the reason behind all this