3 ms·
It marketed itself explicitly as a "Python superset", which could allow Python programmers to avoid learning a second language and write performant code. I'd a
by amval 1y ago
It marketed itself explicitly as a "Python superset", which could allow Python programmers to avoid learning a second language and write performant code.
I'd argue that I am not sure what kind of Python programmer is capable of learning things like comptime, borrow checking, generics but would struggle with different looking syntax. So to me this seemed like a deliberate misrepresentation of the actual challenges to generate hype and marketing.
Which fair enough, I suppose this is how things work. But it should be _fair_ to point out the obvious too.
- fnands 1y agoThey've backed off a little from the Python superset claims and leaned more into "Python family". > I'd argue that I am not sure what kind of Python programmer is capable of learning things like comptime, borrow checking One who previously wrote compiled languages ;-). It's not like you forget everything you know once you touch Python.
- oxidi 1y agoI think the point was that Python syntax is simpler than e.g. borrow checking. Although Python has some seriously PERLesque YOLO moments, like "#"*3 == "###". This is admittedly useful, but funny nonetheless.
- mkl 1y ago* does different things depending on the types of the operands, which is Python's strong typing at work, not Perlesque weak typing. Repeating a string is a useful thing to be able to do, and this is a natural choice of syntax for it. The same thing works for lists: [1]*3 == [1, 1, 1].
- oxidi 1y agoI was referring to the "creative syntax" and it wasn't meant to be an attack on Python. We cannot deny that Python has some interesting solutions, such as the std lib namedtuple implementation. It's basically a code template & exec(). I don't think these are necessarily bad, but they're definitely funny.
- int_19h 1y agoIt does unfortunately mean that sometimes `*` will work (and produce an incorrect result) rather than immediately failing loudly with a clear error message in the context in which it's actually intended to be numerical. More broadly this is the same argument as whether overloading `+` for strings is a bad idea or not, and the associated points, e.g. the fact that this makes it non-commutative - the same all applies to `*` as well, and to lists as much as strings. At least Python is consistent here. Although there is one particular aspect that is IMO just bad design: the way `x += y` and `x = y` work. To remind, for lists these are not equivalent to `x = x + y` and `x = x y` - instead of creating a new list, they mutate the existing one in place, so all the references observe the change. This is very surprising and inconsistent with the same operators for numbers, or indeed for strings and tuples.
- pixelpoet 1y agoI suppose if you accept the innocent-looking "#"+"#"=="##" then your example kind of algebraically follows. Next it's time to define what exp("#") is :)
- amval 1y agoThe second part of the sentence is very important ;) "... but would struggle with different looking syntax"
- Certhas 1y agoAbsolutely. The public sales pitch did not match the reality. This is what I meant with the "Claim to be Ṕython to get VC money" point. To first order, today every programmer starts out as a Python programmer. Python is _the_ teaching language now. The jump from Python to C/Cpp is pretty drastic, I don't think that it's absurd that learning Mojo concepts step by step coming from Python is simpler than learning C. Not syntactically but conceptually.
- ForHackernews 1y agoI've tried learning C a couple times and given up because the curve is too steep to be worth the climb. It's not even the language itself, it's the inherited weight of half a century's worth of cruft. I can't spend weeks fighting with compiler nonsense, header files and #include. Screw it, I'll just use Go instead. I'm learning Rust and Zig in the hope that I'll never have to write a line of C in my career.
- blks 1y agoGeez, what a comment. C is much much more simpler than Rust. You’re not supposed to be spending weeks fighting includes or compiler errors, that means you’re have some very basic misconceptions about the language. Just read K&R “The C programming language” book. It’s fairly small and it’s a very good introduction to C.
- pjmlp 1y agoAgreed, I do bash C a lot, and it has plenty of issues, but hardly a monster that a mythological hero has to face. And as tip for pointers, regardless of the programming language, pen and paper, drawing boxes and arrows, are great learning tools.
- codethief 1y agoI do sympathize with the parent: The language itself might not be that difficult but you also have to factor in the entire ecosystem. What's the modern way to a build a GUI application in C? What's the recommended way to build a CLI, short of writing your own arg parser? How do you handle Unicode? How do you manage dependencies, short of vendoring them? Etc.
- fwip 1y agoI think one of the "Python superset" promises was that any particular dev wouldn't need to learn all of that at once. There could exist a ramp between Python and "fast python" that is more gradual than the old ways of dropping into C, and more seamless than importing and learning the various numpy/numba/polars libraries.
- int_19h 1y agoFWIW generics are already a thing in pure Python as soon as you add type annotations, which is fast becoming the default (perhaps not the least because LLMs also seem to prefer it).