@AaronHall GNU tools use \| to do alternations in basic regular expressions. Basic regular expressions does not have alternation, so this is a GNU extension to them. To use alternations, you would need to use an extended regular expression. With find on macOS, you do that by using find -E -regex .... Note that \( would be a literal parenthesis in an ERE, you you probably want to use ( (no escape) for grouping, and don't escape the | either.
In other words: find . -E -regex '^.*(__pycache__|.py[co])$' -delete
Or just find . -name '*__pycache__' -o '*.py[co]' -delete, which would be portable.
(for a flexible definition of "portable" obviously, since that still uses -delete)
Ping @JennyD too on the above, if you're interested.
@JennyD Sadly, you might have to start rephrasing that as "macOS tools are based on FreeBSD", as the tools vary somewhat across the various BSD systems... Most of it is similar, but some of it is not. OpenBSD find only acquired -delete the other year, for example, and there is a lot more separate development than code sharing happening.
@Kusalananda should that be find . \( -name '*__pycache__' -o -name '*.py[co]' \) -delete? i.e. doesn't the "or" condition need parens so that -delete doesn't bind to just the second part