3 ms·
You make a good point that much of pythong stdlib is implemented in C. But you could implement python's list in pure python, safely. You can't implement somethi
by dahfizz 4y ago
You make a good point that much of pythong stdlib is implemented in C. But you could implement python's list in pure python, safely. You can't implement something like that in rust without unsafe.
- kibwen 4y agoYou can implement lists in Rust safely; with enums, a list is four lines of safe code. You can even implement a doubly-linked list safely. You just can't do either of these things by wielding pointers willy-nilly. If you're willing to accept a performance tradeoff by implementing a list in pure, bootstrapped, FFI-free Python, then you can do the same in Rust.
- alserio 4y agoHow would you implement a python list in python? I mean, what would you consider "acceptable" primitives to do so?
- burntsushi 4y agoYou certainly can! And that's a good example, because it exposes just how important context is to this discussion. Perf matters in certain contexts. If you implemented a list in pure Python, do you think its users would find the overall perf of Python to be acceptable?