Since bash 4 (including zsh) a new globbing option called globstar has been added which treats the pattern
** differently when it's set.
It is matching the wildcard pattern and returning the file and directory names that match then by replacing the wildcard pattern in the command with the matched items.
Normally when you use
**, it works similar to
*, but it's recurses all the directories recursively (like a loop).
To see if it's enabled, check it by
shopt globstar (in scripting, use
shopt -q globstar).
The syntax is the same as you would use for
*. That's why it's known as extended globbing.
**.py would work only for the current directory, as it doesn't return list of directories which can be recurses, so that's why you need to use multiple directory-level wildcard
**/*.py, so it can go deeper.
Please find on SO few syntax tests which I did for finding all the files recursively.