News for hackers. Stuff that matters.
Re:Show HN: Python framework is faster than Golang Fiber by okaleniuk on Tuesday January 10, 2023 @06:48AM (#34323379)
Good point! However, you bring in a common misconception I'm fighting with within my company for a long time. Python is not an interpreted language. There is no such thing as an "interpreted language", a language is just a set or rules and keywords. Everything you can fit into Backus–Naur form is already a language even if it doesn't have any implementation nor compiler neither interpreter.

Just as a piece of evidence, there are interpreted C++ (http://www.artificialworlds.net/wiki/IGCC/IGCC) and AOT Python (https://github.com/exaloop/codon) implementations.

Re:Show HN: Python framework is faster than Golang Fiber by goatlover on Tuesday January 10, 2023 @07:39AM (#34323936)
For all practical purposes, a programming language is defined by it's general real world implementation, and not it's specification. Maybe not so much for computer scientists, but for programmers, Python is interpreted with some JIT alternatives and C++ is compiled.
Re:Show HN: Python framework is faster than Golang Fiber by zelphirkalt on Tuesday January 10, 2023 @08:15AM (#34324342)
This is false. Making a new implementation is a practical purpose. Any new implementation will have to work with the spec, instead of idiosyncracies of other implementations. Ergo there are practical purposes which go by how the language is defined in its specification.

Some languages have more of a proper spec than others, of course. If we look at for example Scheme dialects, then they often change their implementation for better conformance with the various rnrs standards. New Scheme dialects often early on try to conform very much to the standard to avoid issues later on.

Re:Show HN: Python framework is faster than Golang Fiber by IshKebab on Tuesday January 10, 2023 @08:54AM (#34324836)
> Making a new implementation is a practical purpose.

Not yet it isn't. At least not for Python. I mean there are plenty of alternative implementations of Python but they aren't practical because they don't work with CPython modules (as far as I know anyway) so approximately nobody uses them. The de facto spec is "what CPython does".

Re:Show HN: Python framework is faster than Golang Fiber by cirospaciari on Tuesday January 10, 2023 @09:00AM (#34324911)
PyPy work well with CPython modules but the performance is not that great, with CFFI performance is really good in PyPY, HPy project will change this https://hpyproject.org/
Re:Show HN: Python framework is faster than Golang Fiber by throwaway894345 on Tuesday January 10, 2023 @10:01AM (#34325838)
Last I checked, Pypy wasn’t compatible with many important packages in the Python ecosystem. As of a couple years ago, there was no trustworthy, supported package for talking to a Postgres database with Pypy because psycopg2 wasn’t supported.
Re:Show HN: Python framework is faster than Golang Fiber by svth on Tuesday January 10, 2023 @10:17AM (#34326074)
I've been using PyPy and psycopg2cffi in production for the last 5-6 years or so without any issues.

https://pypi.org/project/psycopg2cffi/

Re:Show HN: Python framework is faster than Golang Fiber by throwaway894345 on Tuesday January 10, 2023 @04:48PM (#34332028)
Interesting. I wasn't able to get that working when I tried several years ago. I forget the specific issue.
Re:Show HN: Python framework is faster than Golang Fiber by qorrect on Tuesday January 10, 2023 @11:27AM (#34327302)
When is the last time you checked ?

I have run it with pandas+numpy and postgres+timescale without issue for the last year.

Re:Show HN: Python framework is faster than Golang Fiber by throwaway894345 on Tuesday January 10, 2023 @04:48PM (#34332033)
Several years ago now.
Re:Show HN: Python framework is faster than Golang Fiber by cirospaciari on Tuesday January 10, 2023 @10:06AM (#34325925)
postgresql can work with psycopg2 but is not the same performance as psycopg2cffi , i will integrate some databases to PyPy, and also HPy project will bring any Cython library to PyPy with basically the same performance or better.
Re:Show HN: Python framework is faster than Golang Fiber by okaleniuk on Tuesday January 10, 2023 @09:53AM (#34325710)
I heard that very argument about GCC. C++ without __attribute__ is not practical for embedded development therefore C++ for PLCs is what GCC does. And yet, the general consensus now is that C++ is ISO/IEC 14882, and what GCC does is just an implementation.

With Python, you don't even have to go "alternative" to use LLVM compiler infrastructure. You can use CPython + Numba and compile your kernels for both CPU and GPGPU on the go. Which is very practical.

Which is ironic, to compile a CUDA kernel in C++, you would have to use an alternative NVidia implementation of the language.

Re:Show HN: Python framework is faster than Golang Fiber by okaleniuk on Tuesday January 10, 2023 @09:44AM (#34325565)
I literally posted the links to the AOT Python compiler and to the C++ interpreter.
Re:Show HN: Python framework is faster than Golang Fiber by ddalex on Tuesday January 10, 2023 @09:59AM (#34325798)
A theoretical difference without practical impact; nobody uses these - sure you can implement a C++ interpreter in hardware if one so wishes, but if the industry doesn't use it, what's the good of it ?
Re:Show HN: Python framework is faster than Golang Fiber by messe on Tuesday January 10, 2023 @10:00AM (#34325807)
The commenter above you said:

> general real world implementation

By this they mean the real-world-implementation that is in general use, which in this case is interpreted.

Yes, Python can be compiled and C++ can be interpreted. 99% of the time, they're not though.

When somebody says X language is interpreted, they mean that the most common and widely implementation is an interpreter. That's a useful bit of information to know about a language. "Correcting" them and saying that all languages can be interpreted OR compiled, doesn't really add anything of value to the discussion, other than to label yourself as a pedant.

Re:Show HN: Python framework is faster than Golang Fiber by okaleniuk on Thursday January 19, 2023 @10:54AM (#34441638)
Counterexample. Numba is a Python compiler for heterogeneous computing. We adopted it last year and stopped rewriting code in C++ to run it on GPGPU.

On one hand, the conception from the 90s based on the most common Python implementation, on the other - a compiler that saves us tons of money. Which one adds value again?

Re:Show HN: Python framework is faster than Golang Fiber by mindcrime on Tuesday January 10, 2023 @10:59AM (#34326829)
I literally posted the links to the AOT Python compiler and to the C++ interpreter.

That would be important in high-school debate club. In the real world, most people don't care about obscure edge cases and pedantry. In the industry vernacular, Python is an "interpreted language" and C++ is a "compiled language". Arguing against that in anything other than a highly (highly!) specialized context is just lighting candles in the wind.

Re:Show HN: Python framework is faster than Golang Fiber by okaleniuk on Thursday January 19, 2023 @10:49AM (#34441584)
Numba is a Python compiler for heterogeneous programming. It builds kernels with the same back-end NVCC does. With the equivalent AST, the kernel code it also equivalent.

We adopted it last year, and we don't rewrite code in C++ for GPGPU anymore. We save tons of effort on rewriting and even more on support.

How is this computer science?

Re:Show HN: Python framework is faster than Golang Fiber by RcouF1uZ4gsC on Tuesday January 10, 2023 @07:29AM (#34323811)
You are missing the forrest for the trees.

When people refer to a language, most often they are using it as a synecdoche to refer to the whole language ecosystem and not just the the formal language definition.

If you look at the Python ecosystem, it is most definitely interpreted.

Re:Show HN: Python framework is faster than Golang Fiber by nvrspyx on Tuesday January 10, 2023 @08:06AM (#34324233)
Off topic, but thank you for introducing the word "synecdoche" to me.
Re:Show HN: Python framework is faster than Golang Fiber by j33zusjuice on Tuesday January 10, 2023 @08:29AM (#34324528)
Did you look up how to pronounce it? I was mispronouncing it for like a year after seeing “Synecdoche New York” (it’s kinda pretentious, not for everyone). My coworker laughed at me when I said the name to him. I’d only ever seen it written, and did not look at a pronunciation chart. Wah wah.

Just in case anyone else is getting it wrong like I was …

https://youtube.com/watch?v=v-n1vGeVIXo

(But really, https://youtu.be/u8_LDxZReTc)

Re:Show HN: Python framework is faster than Golang Fiber by narcraft on Tuesday January 10, 2023 @08:22AM (#34324439)
Movie recommendation: Synecdoche New York
Re:Show HN: Python framework is faster than Golang Fiber by zelphirkalt on Tuesday January 10, 2023 @08:24AM (#34324469)
Now the question for non-native speakers is: How to pronounce that word? ;D
Re:Show HN: Python framework is faster than Golang Fiber by nvrspyx on Tuesday January 10, 2023 @08:28AM (#34324521)
Sin-eck-da-key

Or at least, that's how I'm hearing it from Google.

Re:Show HN: Python framework is faster than Golang Fiber by drowsspa on Tuesday January 10, 2023 @08:45AM (#34324744)
I'd pronounce it See-Neh-Doal-Kee
Re:Show HN: Python framework is faster than Golang Fiber by aliqot on Tuesday January 10, 2023 @09:04AM (#34324985)
there is no L in it
Re:Show HN: Python framework is faster than Golang Fiber by drowsspa on Tuesday January 10, 2023 @10:14AM (#34326020)
L sounds like a short "OO" in Brazilian Portuguese, and he asked how a non-native would pronounce it...
Re:Show HN: Python framework is faster than Golang Fiber by cirospaciari on Wednesday January 11, 2023 @04:26AM (#34336684)
Exactly
Re:Show HN: Python framework is faster than Golang Fiber by zelphirkalt on Tuesday January 10, 2023 @08:27AM (#34324506)
Personally, I often find myself saying things like "the <lang> ecosystem" to avoid this.

I think it is fair to have a discussion about terminology and arguing with the actual meaning of terms. When there is a technical difference, it would be good to acknowledge that difference between terms. It does not hurt anyone to do that. One can still say something like: "When we communicate I will use the word x for meaning y, because it is shorter and more convenient."

Re:Show HN: Python framework is faster than Golang Fiber by JustSomeNobody on Tuesday January 10, 2023 @08:18AM (#34324382)
> ... I'm fighting with within my company for a long time...

I bet that's fun.

> There is no such thing as an "interpreted language"...

In the common vernacular, yes, there are.

Re:Show HN: Python framework is faster than Golang Fiber by ModernMech on Tuesday January 10, 2023 @09:14AM (#34325094)
That’s the old way of language design; used to be that to create a “programming language”, you’d write a spec and call it a day. That just doesn’t fly anymore. These days, you actually have to implement a parser and compiler, and not only that, you have to write the entire standard library as well, along with a toolchain complete with debugger, profiler, package manager, language server implementation, etc.

All this is to say that a programming language these days is really the sum of its parts, not a spec.

Re:Show HN: Python framework is faster than Golang Fiber by kaba0 on Tuesday January 10, 2023 @09:34AM (#34325421)
The language describing the syntax of a language is very different from its semantic interpretation.

E.g. many languages’ syntax is context-free, yet the languages themselves are almost always Turing-complete.

Re:Show HN: Python framework is faster than Golang Fiber by jchw on Tuesday January 10, 2023 @09:52AM (#34325701)
Even if there isn't literally such a thing as an "interpreted language" there are absolutely design choices made in Python that you wouldn't make if you wanted it to be fast at runtime. To be fair, this is also true of JavaScript, but in Python the choices were literally intentional, as simplicity of CPython and elegance of the language were long valued over performance.

OTOH, interpreting C++ is actually a pain in the ass due to design choices it makes specifically regarding the semantics of translation units. You can see similar pain when trying to say, make a Go REPL: it's just not tuned for this.

It is of course technically possible to compile almost anything ahead-of-time. But, if you effectively wind up having to ship an interpreter or JIT into the resulting binary to run some code anyways, it's almost for naught. Both Python and JavaScript have eval. Python also has several other cases like Pickle where this can be an issue. PyPy being a JIT makes a lot of sense because it wants to be a drop-in replacement, and that makes the most sense for a language with these constraints. Codon can do AOT, but for practical reasons it is not nearly a drop-in replacement for CPython, just like the other Python AOT implementations.

A practical Python AOT is not compatible with loads of things that people associate with Python, like Django. PyPy is compatible with more, but even it is far from a drop-in today, and that is a problem.

> A language is just a set or rules and keywords. Everything you can fit into Backus–Naur form is already a language even if it doesn't have any implementation nor compiler neither interpreter.

This is objectively true. However, in practice, there are a finite number of available toolchains for any given language that exist today, and creating new ones is a non-trivial endeavor, especially production-quality ones. A language is just a set of rules and keywords. However, when people use Python and write Python, they are not merely writing Python to fit into those keywords and rules. They're writing Python to be executed and solve a problem, typically using CPython. Python is a language, but it's also an ecosystem.

In the same token, if something like Codon doesn't even support all of the things you can fit into Backus-Naur form about Python as it is in CPython and PyPy, can it even be called Python in this sterile technical sense?

Re:Show HN: Python framework is faster than Golang Fiber by phkahler on Tuesday January 10, 2023 @10:04AM (#34325874)
>> However, you bring in a common misconception I'm fighting with within my company for a long time. Python is not an interpreted language.

My advice to you: Stop fighting that "misconception". See the other responses to back up the idea that Python is interpreted. The existence of a Python compiler is also not relevant here, as the linked project does not list that as a supported Python variant.

Let's assume that by some technicality you are not wrong. The "misconception" is so common that it is generally a fact in peoples mind. Rather than convince them, you are destroying your own credibility and probably making a fool of yourself in their eyes. And remember, I prefaced this with you not being wrong. It's worse for you if you are wrong. Just stop for your own good.

Re:Show HN: Python framework is faster than Golang Fiber by BobbyJo on Tuesday January 10, 2023 @10:53AM (#34326715)
Common nomenclature is a hard thing to rally against, and probably not worth the fight.
Re:Show HN: Python framework is faster than Golang Fiber by RHSman2 on Tuesday January 10, 2023 @10:59AM (#34326831)
Like asking an engineer not to argue a detail!!!
Re:Show HN: Python framework is faster than Golang Fiber by dymk on Tuesday January 10, 2023 @11:25AM (#34327269)
While I also find arguing for the sake of arguing tiresome, the comment your responding to makes a good point. The linked project beats Go fibers using PyPy, which is JIT compiled, where hot codepaths are not interpreted. A language is a set of rules (hopefully described in a specification...) - you can have interpreted C++, or compiled Python. The popular implementations are just that: implementations, of which others exist.

> Rather than convince them, you are destroying your own credibility and probably making a fool of yourself in their eyes.

I'd understand where you were coming from had the parent comment not explained what they meant and given examples.

Re:Show HN: Python framework is faster than Golang Fiber by okaleniuk on Thursday January 19, 2023 @10:42AM (#34441488)
Sorry, I didn't make it clear before. I'm winning. My credibility is well protected by our AWS bills.

Last year we adopted Numba for GPGPU programming. It is a Python compiler with LLVM back-end and full CUDA support. It generates the same code that NVCC (CUDA compiler for C++) does only it compiles Python code and not a C++ .cu dialect.

No one in our organization writes heterogeneous code in C++ anymore.

Re:Show HN: Python framework is faster than Golang Fiber by pdpi on Tuesday January 10, 2023 @10:32AM (#34326324)
> There is no such thing as an "interpreted language", a language is just a set or rules and keywords.

Sure there is. Even if it is technically possible to write an interpreter for a "compiled" language, or a compiler for an "interpreted" language, language design really pushes you towards one or the other. "Technically possible" can also represent a very real challenge, as that set of rules and keywords might make ahead-of-time compilation either impossible or pointless.

E.g. any language that exposes `eval` with an arbitrary argument will still need to ship an interpreter as part of the runtime even if you compile some of the code ahead of time. Monkey-patching is common in Python and Ruby, and is pretty hostile to compilation. Codon has several documented limitations around this. Perl 5 famously can't be statically parsed without evaluating the code as you go, which completely defeats any attempt at compiling it.

Inversely, You can write an interpreter for C++, but features like `consteval` and `constexpr` are meaningless without ahead-of-time compilation.

Re:Show HN: Python framework is faster than Golang Fiber by dymk on Tuesday January 10, 2023 @11:30AM (#34327361)
> Inversely, You can write an interpreter for C++, but features like `consteval` and `constexpr` are meaningless without ahead-of-time compilation.

No they're not, `constexpr` and `consteval` indicate where you can use an expression, not when in the compilation/interpretation pipeline they need to be evaluated. The spec does not say that C++ has to be compiled, nor does the spec say "A compiler must execute `constexpr` expressions prior to entering `main()`".

If you think this is just being pedantic, well, that's kind of the point of a spec.

Re:Show HN: Python framework is faster than Golang Fiber by j1elo on Tuesday January 10, 2023 @10:45AM (#34326530)
Language is used to communicate. And not needing to be absurdly verbose in everything that one says, is a virtue and a need for efficient transmission of concepts and idea.

So when someone says "Python is an interpreted language" they are pleading to an implicit preexisting shared knowledge about the nature of the most commonly found usage of the concept.

Granted, when this shared knowledge doesn't match, that's where misunderstandings can happen, but that's the nature of human language. In this case I'd be hard pressed to think that any misunderstanding could have been possible for the immense majority of people reading this.

Re:Show HN: Python framework is faster than Golang Fiber by MobiusHorizons on Tuesday January 10, 2023 @11:46AM (#34327576)
There are language features of dynamic languages like python that prevent them from being compiled to machine code. That is to say, the compiler can’t know what assembly to output from the code itself, it also has to know some type information which isn’t available until runtime. I would encourage you not to fight the classification of interpreted language as your primary argument. You will likely lose credibility with the listener before you have a chance to make any good points. You could for instance say “just because the reference implementation is slow doesn’t mean there is no hope for the language becoming fast”. There is some truth to the argument. JavaScript has become a reasonably fast language with all the engineering effort spent on engines for it. But I would also spend some time learning about what makes dynamic languages hard to compile. I think you will find that some features of the language must be dropped to achieve fully aot compilation. The classic example would be eval() which invokes an interpreter from inside the language, but there are usually other features.
Re:Show HN: Python framework is faster than Golang Fiber by dang on Tuesday January 10, 2023 @01:25PM (#34329188)
We detached this subthread from https://news.ycombinator.com/item?id=34323277.