Skip to content
0:00 / 0:00

#ducktyping#eafp#exceptionhandling

Python Tutorial: Duck Typing and Asking Forgiveness, Not Permission (EAFP)

Corey Schafer

1.5M subscribers • 1 video on Hallway

YouTube
  • Recommended by 1 person: 1 on Stack Overflow and its sister sites.
  • Presented by Corey Schafer
  • Linked in the descriptionCoreyMSchafer/code_snippets

Beginner. No background in the topic needed.

142K views10 years ago1 recommendation

Programming languagesPython

Corey Schafer explains the concepts of duck typing and 'easier to ask forgiveness than permission' in Python.

In this Python Tutorial, we will look at a couple of the aspects of being "Pythonic". If you've never heard the term Pythonic before, basically it means that you are following conventions and coding styles of the Python language in order to write clean and readable code. In this video we'll specifically be looking at two aspects of being Pythonic, and those are "Duck Typing" and the concept that it is easier to ask forgiveness than permission (EAFP). Let's get started. The code from this video can be found at: github.com/CoreyMSchafer/code_snippets/tree/master/EAFP ✅ Support My Channel Through Patreon: patreon.com/coreyms ✅ Become a Channel Member: youtube.com/channel/UCCezIgC97PvUuR4_gbFUs5g/join ✅ One-Time Contribution Through PayPal: goo.gl/649HFY ✅ Cryptocurrency Donations: Bitcoin Wallet - 3MPH8oY2EAgbLVy7RBMinwcBntggi7qeG3 Ethereum Wallet - 0x151649418616068fB46C3598083817101d3bCD33 Litecoin Wallet - MPvEBY5fxGkmPQgocfJbxP6EmTo5UUXMot ✅ Corey's Public Amazon Wishlist a.co/inIyro1 ✅ Equipment I Use and Books I Recommend: amazon.com/shop/coreyschafer ▶️ You Can Find Me On: My Website - coreyms.com/ My Second Channel - youtube.com/c/coreymschafer Facebook - facebook.com/CoreyMSchafer Twitter - twitter.com/CoreyMSchafer Instagram - instagram.com/coreymschafer/ #Python

Why it's here

1 person recommends this

What people say. Recommended as an excellent explanation of the EAFP coding style in Python.

Micael Jarniacon Stack Overflow • Recommends

…hints (PEP 484) to your Python programs, and use mypy to type check them statically. Find bugs in your programs without even running them! You can mix dynamic and static typing in your programs. You can always fall back to dynamic typing when static typing is not convenient, such as for legacy code. Here's an awesome YouTube video about EAFP: link to this video I'm trying to use mypy , but it's getting angry basi……