Ooh, ooh, I can do that in Python! I can do that in Python! Python can do that!Dr Darren says:
I am not anti-Python. I use Python (but not only), and Webel IT Australia offers professional Python services (but would always advise first where another technology solution, such as Wolfram Mathematica, might be a better technology fit). What I am "anti" is some of the indiscriminate claims made about Python's superiority for task X, Y, or Z that some over-zealous Python users seem compelled to make on behalf of Python – typically by Python coders who have never used another language.
Is Python as powerful as the Wolfram Language of Mathematica?
Dr Darren of Webel IT Australia says: 'No! Python is not even vaguely close, it's not even in the same league. The blues guitarist Muddy Waters once said (paraphrased from the book Blues People)':"I have been and left places other people have not even seen"
'Python can also do symbolic algebra like Mathematica!'
Dr Darren says: 'Don't be silly. Mathematica does actual mathematics.'
'Python can do data visualisation, plotting, and 3D!'
Dr Darren says: 'For real, you wish to go toe-to-toe with Python vs Mathematica on data visualisation, plotting, data transformation, 3D, and graphics? Really?'
"The functional capabilities of Python are superior to Mathematica!"
Dr Darren says: 'No! Mathematica is functional on steroids!!!'
'But Mathematica can't do OO!'
Dr Darren says: 'Visit these':
Python also supports OO Interfaces through ABC
and @abstractmethod
(not that interfaces are used enough by many Python coders), whereas the OO Interface concept does not have a natural equivalent in Wolfram Language (which emphasises symbolic functional approaches).
But the same is true vice-versa; it can be frustrating for those fluent in Wolfram Language to work in Python. Often, when I am working in Python, I think to myself "I could have done that in seconds with less code in Mathematica".
'The IDEs for Python are better!'
Dr Darren says: 'Visit this':
The integration of pseudo OO with ADTs is currently not ideal in the main Mathematica Notebooks, but the Wolfram Language IntelliJ Plugin works well with ADTs (but not so well with the user-contributed MTools packages for OO). It's worth it for the extra powers of Mathematica for many tasks.
'Python is THE best for testing!'
Dr Darren says: 'Visit this:
'Python is free!'
Dr Darren says: 'That much is true. But it depends on whether you expect your organisation or client to spend heaps of money instead on your hours (wage, salary, consultancy fees) instead of investing in a powerful tool that will help you get the job done faster, better, quicker, stronger, smarter.''Mathematica costs money!'
Dr Darren says: 'So do you if you keep insisting that you can do things more cost-effectively in Python than someone who commands the Wolfram Language can in Mathematica. ''Python is easier to learn than the Wolfram Language!'
Dr Darren says: 'Remind me to inform all top concert pianists and violinists to please not use those instruments because they are too hard to learn and it's not fair. Besides:'
'Python is THE language of ... AI .. ML .. data science ..
Dr Darren says: 'Just saying it ever so enthusiastically over and over doesn't make it true. And Mathematica users don't care because Mathematica can speak Python too, and even has a dedicated built-in Python CLI.'
Zealous Python enthusiast on seeing something cool done in Mathematica:
'I can do that, I can do that, I can do that in Python!
Dr Darren says: 'I can probably do that with a Turing Machine ticker tape, but that doesn't make it the best choice. I can also usually do that with other languages and technologies, maybe I would choose Python, maybe I would choose something else. Because I know there is more than just Python!'
'I found something that Python can do that Mathematica can't!
Dr Darren says: 'I found a googolplex of things Mathematica can do that Python can't, and Mathematica can handle a googolplex just fine.'
'Python is faster!
Dr Darren says: 'Ahem. Wolfram language code is mostly not slower than Python when coded with awareness of the language, and it can mostly be efficiently compiled to C (and easily) anyway. Identified bottle-necks can be identified and coded to permit compilation.
And there is more to the story than just execution time. My own time is worth more to me than minor performance differences (if any), and developing in the Wolfram Language is usually much faster for me (and I'm pretty fast with Python).
Next challenge please.
Dr Darren says:
Given a choice between coding something in Python or in the Wolfram Language in Mathematica, if Mathematica can handle it, I will choose Mathematica every single time. Because I will then have access to a heap of other capabilities I would not have with Python.
And if you got this far, just so you know I'm not a Mathematica zealot picking on Python zealots, I thought I'd leave you with one area where Python is clearly stronger, and it isn't Pandas for data processing, and it isn't Pydantic, and it certainly isn't database interaction or any aspect of data handling or transformation, and no, it isn't anything to do with LLM or so-called "AI", which Mathematica is all over:
Mathematica is not the best choice for developing most kinds of modern web applications (although it definitely can help serve end points and can be used to develop web applications), and the FastAPI packages for RESTful web services in Python are excellent.