> The flexibility benefit modern Python gives is probably more like 1000x
In my personal experience, this hasn’t been true for me. Granted, I’ve been mostly ignoring C++17 because I like to give compilers a little time to catch up, so I haven’t been exposed to std::visit beyond reading about it, but C++11 (and 14 to a lesser extent) have been really productive for me. It’s more verbose for sure, but that’s largely a non-issue especially with editor support. I also find it easier to manage and localise state in C++ (I’m a Clojure developer at heart so carefully management of mutable state is important to me) simply because in Python everything (including method dispatch) is mutable and in large codebasrs it can be very difficult to know when things are being changed behind my back. C++ allows you to mutate things too, of course, and since you have low level memory access you can do some truly horrific things, but most of the time it doesn’t happen outside of isolated performance optimisations so it hasn’t been an issue for me.
TL;DR: Python is great and productive, but I personally am really productive in C++ too.
EDIT: you edited while I was writing, so in response to the latter part of your message:
std::visit, at least from my understanding of it, is really rather misnamed. It’s not a generic visitor pattern that you might apply over a collection but a tool for applying different functions on a variant, based on the type contained in the variant.
Your example of Python visitor pattern boiling down to map() and a few dunder functions isn’t really different from C++ where it boils down to iterators. You have a lot of the flexibility available at compile time with templates too, my comment about not needing the flexibility was directed specifically at runtime modifying of objects (messing with its dispatch dict), stuff like overriding dunder methods is akin to templates in C++ in many ways and that flexibility exists in both languages.
Btw to be clear, I’m not saying it’s not easier in Python, because it obviously is easier, I’m just saying that for me the productivity gap isn’t thaaaat large for most code, I don’t need the runtime flexibility in most code and C++ doesn’t pay a performance premium.
I should add that I’m nitpicking a bit and not suggesting people use C++ over Python at all. I agree with a lot of what you’re saying, my disagreement is really over the productivity gap, since if you truly need the performance (most use cases don’t), then going directly to C++, at least for me, is often a sensible choice.