Grow your YouTube views, likes and subscribers for free
Get Free YouTube Subscribers, Views and Likes

Why You Shouldn't Mix Direct Returns with Callbacks

Follow
Senior Code Review Buddy

There are a few ways to return values from functions, with the two main ones being:
1) Directly as a return value
2) through a callback that

While both have their times and places to be used, they shouldn’t be used together in the same function as it creates a confusing interface.
Today we’ll look at some confusing examples where they are used together, and see how things can be made cleaner.

While today’s examples are in Python, the ideas discussed can apply to most languages.

The outro music is:
Funk Game Loop by Kevin MacLeod is licensed under a Creative Commons Attribution 4.0 license. https://creativecommons.org/licenses/...
Source: http://incompetech.com/music/royalty...
Artist: http://incompetech.com/

00:00 Introduction
01:35 Example 1
09:08 Example 2
14:01 Wrap up

posted by cronicobarnc