4 ms·
There are several "close to python" languages like this, actually, I remember one popping up on HN semi-recently. If you expand into just "kind of Python-like"
by spijdar 4y ago
There are several "close to python" languages like this, actually, I remember one popping up on HN semi-recently.
If you expand into just "kind of Python-like", you have languages like Nim that approximately fill the hole of "efficient Python".
My impression, though, is a lot of the popular frameworks/libraries for Python lean heavily on runtime reflection in Python (e.g. Django). So people end up stuck to the full Python interpreter/runtime.
- Simran-B 4y agoI consider Ruby to be quite similar to Python. However, it's kind of like Python's weird brother, with optional parentheses for calls without arguments, auto-returning the result of the last expression, and some odd-ball syntaxes. It manages to be even less efficient, though.
- quesera 4y agoAs someone who probably has more experience with Ruby than you do, and probably less with Python, I'd characterize the relationship as inverted -- Ruby is more consistent than Python. In Ruby, parens are optional for all methods, and only required if you need to force non-default precedence. Returning the value of the last expression seems reasonable to me (just like a UNIX shell). In Python, I'm bothered by the little inconsistencies. Why is str.len (or length, or size, or count, etc) not a method? Why len(str) instead? And Python has plenty of oddball syntax: significant whitespace, triple quotes?? You get used to it of course. Ruby and Python are about equally efficient -- if you're optimizing for code efficiency, both are bad choices. In many domains, that's not a critical metric, so we talk about developer efficiency. I'll argue that developers are more efficient when they are more happy, and for me that selects Ruby by a mile over Python. But I won't pretend that it's more than a matter of taste. :)
- wood-porch 4y agoI feel very similarly about Python vs. Ruby inconsistencies! I remember starting a job and used python for the first time coming from Ruby, and being extremely disappointed in the inconsistencies in the standard library and the sheer… lack of features in the Stdlib compared to Ruby. I’ve yet to use a language with such a magnificent stdlib and documentation. I main python nowadays, and I find the ecosystem and typing to be better than Ruby, but Ruby is the best language I’ve ever used for many reasons
- Turing_Machine 4y ago> And Python has plenty of oddball syntax: significant whitespace Yes. Especially this. The whitespace thing in and of itself has kept me from ever developing a fondness for Python. Clearly there are plenty of people who aren't bothered by it. De gustibus.
- Simran-B 4y agoSignificant whitespace is probably my favorite feature of Python, which might have to do with the German keyboard layout making it very cumbersome to enter curly braces.
- Simran-B 4y agoMaybe not oddball syntax, but rather syntax that doesn't make intuitive sense. With Python, only nested list comprehensions come to my mind that are a bit tricky to read. With Ruby, I often felt lost reading code and it was sometimes hard to figure out the name of a thing or search for a specific syntax, e.g. with a single character like @ - especially in the official reference documentation. But maybe it's on me for not learning Ruby properly first.
- dragonwriter 4y ago> I consider Ruby to be quite similar to Python. They are both dynamic, OO scripting languages, whose main implementation has a GIL, but beyond that, they aren’t all that similar. > However, it’s kind of like Python’s weird brother, Methods-with-self-in-args-list isn’t the “weird” one? > with optional parentheses for calls without arguments Parens are optional in Ruby on method calls and method definitions except where necessary to resolve ambiguity (including in the newer special single-line method definition syntax, its not a special syntax option for no-arg methods > auto-returning the result of the last expression Ruby is basically an expression-oriented language [0], everything returns a value, and a sequence of expressions returns the last expression in the sequence. Explicit “return” lets you short-circuit that. Python is a statement-oriented language, and statements don’t return things except an explicit return tells the function its in to return something. Both are common kinds of languages, just very different. Neither is “weird”.
- Simran-B 4y ago> Methods-with-self-in-args-list isn’t the “weird” one? I agree that it's uncommon, but I do like the clarity it adds compared to something like "this" which magically refers to the current instance. Hasn't C++ just added something like it with "deducing this"?
- cb321 4y agoNim has impressive compile-time reflection which with its syntax macro system can (some of the time) get you similar powers to Python's dynamic reflection. E.g., https://github.com/c-blake/cligen https://github.com/c-blake/cligen instead of `autocommand` or `click` or `argh` or you name the automatic CLI generator, only with full C-like speed for your programs and a very low effort FFI to C. People have done web frameworks, too, but I do not know them well enough to compare to Django. Perhaps someone else could follow-up. Compile times are not the 25-50 ms of a Python interpreter startup, but they are similar to the 250-500 ms of a Go or D compile, at least for small light on metaprogramming loops kinds of programs, and with, say, the TinyC tcc backend. Of course, big frameworks take a long time to import (or to compile). So, your comparison mileage may vary. And once "ready to go" and finished a Nim program can start up in sub-millisecond time like any C program (esp. if statically linked).