I seriously cannot think of anything I could do to exceed Python.
Does it do everything? No. But name a tool with significantly greater overall reach. Some compete, but seriously. . .
There’s no reason a new scripting language couldn’t excel in all three of those areas. But AFAIK none currently come close.
Also what is wrong in having a switch statement? (I`d like one with range cases 1<x<10..)
Accesing dicts with a struct syntax.
'Inline' C functions.
JIT, especially for loop acceleration.
if par:
do_stuff()
Python does some really cool, if slightly unintuitive, checks for "truthiness" where 0, [], {}, false, '' and None (could be other cases too, brain's a little foggy today) all evaluate as false. This controls for: if par = None:
do_stuff()
not catching empty lists, empty dicts, etc. _notset = object()
def foo(x=_notset):
if x is _notset:
print("foo was called as foo()") if par is None: ...
As for accessing dicts with a struct syntax, I prefer keeping dicts and objects different things (unlike Javascript).And for JIT, there's numba!
Agreed on the switch statement...
It's a personal project so I like to experiment, but it's also a CLI program that accepts command line arguments, runs, and then exits, so a 3-5 second delay _each_time_ it runs is pretty painful.
Luckily for me there's a 'single directory' option, which puts everything (uncompressed) into a folder. Snappy start because there's no decompression step, and while I like the idea of a single file .exe it turns out I don't really need that (I'm not copying the program from computer to computer).
So - thumbs up for PyInstaller!
Try including pandas with a few other popular libraries.
Suddenly you have 500MB blobs. Not very practical for passing around multiple projects.
I suppose that is not worse than Electron apps...
I did this before and found it really easy to integrate. The provided C API surface is really easy to integrate with. It was literally just a case of detailing my types, calling the Py runtime and then querying the results/side effects.
Having never done something like that before, i was full of trepidation - i was amazed at how easy it was.
Python is the second-best language for everything.
Just off the top of my head:
- Pattern matching
- Multi-line lambdas
- Proper variable capture in lambdas and inner functions (as was fixed with the 'let' keyword vs 'var' in recent versions of JavaScript)
- Support for cyclic imports (a bad pattern in general but necessary in some cases)
- A well-defined C API for extensions that doesn't get them too entangled in the internals of CPython. This would make it possible for other implementations to reach the level of library support that CPython enjoys.
Multi-line lambdas can be sort of obtained in Python by defining a progn function: