It Really is Easier to Ask for Forgiveness (than Permission)
This video is also available in the GOTO Play video app! Download it to enjoy offline access to our conference videos while on the move.
It's a Pythonic maxim that "it's easier to ask for forgiveness than permission" and Pythonic code is written with a strong preference for attempting an operation and raising exceptions as needed. This contrasts with many languages which take a "look before you leap" approach where conditions, types, and values are checked in advance.
This tendency to raise exceptions first and ask questions later strikes coders from other languages (and even some Pythonistas) as reckless, strange, and inefficient. Wouldn't it be "better" to do a little checking and avoid exceptions? Exceptions can't be intended to be used so frequently, can they? Surely raising so many exceptions results in slow and inefficient code?
This talk will address all of those concerns. We'll show how and why Python's approach is a strength, not a weakness, which makes Python more expressive and flexible. We'll also see that raising exceptions is integral to Python, and underlies many common features of the language. Finally, we'll look at some simple tests that show that the Pythonic use of exceptions usually is faster and more efficient than look before you leap checking in most cases, and we'll also discuss a few situations where "look before you leap" might be preferred.
Who should attend this talk: People interested in how programming languages work and how they differ; people using Python who want to use it effectively; people who want to critique Python code and mentor effectively.
Academic level: Introductory
What is the take away in this talk: That a particular languages idioms and best practices are not what you might expect based on other languages; specifically that exceptions in Python should not be judged based on exceptions in Java, C++, or any other language.
-
It Really is Easier to Ask for Forgiveness (than Permission)Naomi CederTuesday Apr 30 @ 10:20 AM
-
The Soul of Erlang and ElixirSaša JurićMonday Apr 29 @ 3:10 PM
-
Reactive SpringJosh LongMonday Apr 29 @ 10:20 AM
-
Go vs. Elixir for Distributed ComputingVerónica LopezMonday Apr 29 @ 10:20 AM
-
Embracing the Future in a Multi-Platform World: A Kotlin StorySean McQuillanTuesday Apr 30 @ 4:20 PM
-
Getting Started with Quantum ProgrammingGuen PrawiroatmodjoMonday Apr 29 @ 10:20 AM
-
Kotlin: Dissecting the stdlibHuyen Tue DaoTuesday Apr 30 @ 3:10 PM
-
The Language of ProgrammingAnjana VakilMonday Apr 29 @ 11:30 AM
-
Java Current and FutureMikael VidstedtGeorges SaabMonday Apr 29 @ 5:30 PM
-
Server-side Kotlin with CoroutinesRoman ElizarovTuesday Apr 30 @ 5:30 PM
-
Why You Need a Software Delivery MachineRod JohnsonTuesday Apr 30 @ 5:30 PM
-
Achieving Functional Programming in JavaJohn NapierTuesday Apr 30 @ 11:30 AM
-
Why Open Source Firmware is ImportantJessie FrazelleTuesday Apr 30 @ 5:30 PM
-
Fueling the Quantum Application Era with the CloudMurray ThomTuesday Apr 30 @ 11:30 AM