News for hackers. Stuff that matters.
Re:A high-performance, zero-overhead, extensible Python comp... by quotemstr on Wednesday September 18, 2024 @03:15PM (#41584219)
It's not even a subset. They break foundational contracts of the Python language without technical necessity. For example,

> Dictionaries: Codon's dictionary type does not preserve insertion order, unlike Python's as of 3.6.

That's a gratuitous break. Nothing about preserving insertion order interferes with compilation, AOT or otherwise. The authors of Codon broke dict ordering because they felt like it, not because they had to.

At least Mojo merely claims to be Python-like. Unlike Codon, it doesn't claim to be Python then note in the fine print that it doesn't uphold Python contractual language semantics.

Re:A high-performance, zero-overhead, extensible Python comp... by orf on Wednesday September 18, 2024 @04:31PM (#41585092)
Try not to throw around statements like “they broke duct ordering because they felt like it”.

Obviously they didn’t do that. There are trade-offs when preserving dictionary ordering.

Re:A high-performance, zero-overhead, extensible Python comp... by actionfromafar on Wednesday September 18, 2024 @05:33PM (#41585814)
The trade-off is a bit of speed.
Re:A high-performance, zero-overhead, extensible Python comp... by cjbillington on Wednesday September 18, 2024 @06:44PM (#41586438)
This might be what you meant, but the ordered dicts are faster, no? I believe ordering was initially an implementation detail that arose as part of performance optimisations, and only later declared officially part of the spec.
Re:A high-performance, zero-overhead, extensible Python comp... by Someone on Thursday September 19, 2024 @02:28AM (#41589143)
> but the ordered dicts are faster, no?

They may be in the current implementations, but removing an implementation constraint can only increase the solution space, so it cannot make the best implementation slower.

As a trivial example, the current implementation that guarantees iteration happens in insertion order also is a valid implementation for a spec that does not require that guarantee.

Re:A high-performance, zero-overhead, extensible Python comp... by dathinab on Wednesday September 18, 2024 @06:56PM (#41586542)
if you claim

> high-performance Python implementation

then no this aren't trade-offs but breaking the standard without it truly being necessary

most important this will break code in a subtle and potentially very surprising way

they could just claim they are python like and then no one would hold them for not keeping to the standard

but if you are misleading about your product people will find offense even if it isn't intentionally

Re:A high-performance, zero-overhead, extensible Python comp... by baq on Thursday September 19, 2024 @03:20AM (#41589401)
dicts ordering keys in insertion order isn't an implementation detail anymore and hasn't been for years.
Re:A high-performance, zero-overhead, extensible Python comp... by nick238 on Thursday September 19, 2024 @03:21PM (#41595368)
I get that all dicts are now effectively an `collections.OrderedDict`, but I've never seen practical code that uses the insertion order. You can't do much with that info (no `.pop()`, can't sort a dict without recreating it) beyond maybe helping readability when you print or serialize it.
Re:A high-performance, zero-overhead, extensible Python comp... by funny_falcon on Friday September 20, 2024 @04:06PM (#41605136)
Readability, reproducibility, and simple LRU.

Reproducibility matters for tests, they become simpler. Some other algorithms become simpler as well.

LRU is just a dict with preserving order: on access just delete and insert again.

Re:A high-performance, zero-overhead, extensible Python comp... by adammarples on Wednesday September 18, 2024 @05:03PM (#41585454)
Well would you claim that Python 3.5 isn't python?
Re:A high-performance, zero-overhead, extensible Python comp... by stoperaticless on Wednesday September 18, 2024 @05:52PM (#41585974)
All versions of python are python.

If lang is not compatible with any of python versions, then the lang isn’t python.

False advertising is not nice. (even if the fineprint clarifies)

Re:A high-performance, zero-overhead, extensible Python comp... by thesz on Thursday September 19, 2024 @01:44AM (#41588895)
> If lang is not compatible with any of python versions, then the lang isn’t python.

Python versions are not compatible between themselves, as python does not preserve backward compatibility, ergo python is not python.

Re:A high-performance, zero-overhead, extensible Python comp... by KeplerBoy on Thursday September 19, 2024 @02:40AM (#41589204)
The words "any" and "all" have a different meaning.
Re:A high-performance, zero-overhead, extensible Python comp... by skeledrew on Thursday September 19, 2024 @10:33PM (#41598279)
Interestingly I recently had to run a script I wrote for 3.11 on an old system that has 3.6, and the only thing I had to remove were a few type hints (which of course don't affect function). Seems pretty backwards compatible to me.
Re:A high-performance, zero-overhead, extensible Python comp... by stoperaticless on Sunday September 29, 2024 @05:39AM (#41686125)
Pretty compatible != compatible.

(I can edit my own script, I would hate if installation instructions for “django” would include “just remove the type hints from the scripts”)