News for hackers. Stuff that matters.
Re:Nuitka: a Python compiler written in Python by lmm on Thursday June 17, 2021 @10:38AM (#27540046)
I used to take your view, but actually there are plenty of languages (e.g. ML-family languages) where you get the best of both worlds - light, clean syntax, but also type safety and decent performance.
Re:Nuitka: a Python compiler written in Python by garyrob on Thursday June 17, 2021 @12:30PM (#27541457)
I experimented with OCaml and some of my Python code. I found that using Python with Numba enabled me to get much better performance than the same algorithm written in OCaml.

In this case, using Numba for the performance-critical aspect was trivially simple, just the addition of a decorator. And I've found that is generally pretty close to true, at least for the kinds of things where I care about performance.

That's why I'm still in the Python world rather than the OCaml world for my algorithmic work. I really like OCaml as a language and would actually prefer to use it, but Python/Numba seems to give me substantially better performance, as well as all of Python's standard libraries.

And Numba lets you turn off the GIL, so you can get multiple cores going at once.

YMMV, of course. I'm not making a general claim that would be true for everyone. But I think it may be worth mentioning that it could be true for more uses than one might assume.

Re:Nuitka: a Python compiler written in Python by adsharma on Thursday June 17, 2021 @10:56AM (#27540243)
I'm sympathetic to this point of view. But then there is 25 yrs of stdlib that's tattooed onto people's brains and stackoverflow.

A pure python implementation of python stdlib ready be transpiled could be that bridge.

Also it's possible to support multiple source syntaxes in such an ecosystem. ML based, python based or even a hybrid. In the end all I need is a well documented AST.

Re:Nuitka: a Python compiler written in Python by willseth on Thursday June 17, 2021 @12:14PM (#27541268)
One of the main reasons people choose Python is the huge stdlib and vast package ecosystem. This is difficult to ignore if you need to do some very heavy lifting.
Re:Nuitka: a Python compiler written in Python by tenacious_tuna on Thursday June 17, 2021 @10:51AM (#27540186)
Can you share some examples? I'm very interested in a typesafe alternative to python, but low friction is also necessary.
Re:Nuitka: a Python compiler written in Python by lmm on Thursday June 17, 2021 @09:03PM (#27546261)
Personally I moved to Scala, which has a poor reputation because of some symbol-heavy libraries, but you can use it to write very clean Python-like code. Version 3 has actually added a more Python-inspired syntax with colons and indentation instead of braces.

Standard ML was where I started. As a language it's great, as an ecosystem it's limited. OCaml seems to be where the action is (and even then its packaging/dependency management isn't great - but then it can't be worse than Python's).

F# has a very good reputation but I haven't used it a lot myself.

Re:Nuitka: a Python compiler written in Python by tooltower on Thursday June 17, 2021 @11:18AM (#27540527)
They said ML family, so that's usually OCaml and SML.
Re:Nuitka: a Python compiler written in Python by nwatson on Thursday June 17, 2021 @11:38AM (#27540785)
I use JetBrains PyCharm with type annotations in my code. I run the type-checker/linter ("Inspect Code") every 10 minutes or so, it's muscle-memory at this point. It covers most cases, problem resolved.
Re:Nuitka: a Python compiler written in Python by nestorD on Thursday June 17, 2021 @11:21AM (#27540569)
F# comes to mind. It uses indentation instead of braces and has a nice ecosystem.
Re:Nuitka: a Python compiler written in Python by adsharma on Thursday June 17, 2021 @10:57AM (#27540257)
Why do you think python3 is not typesafe?
Re:Nuitka: a Python compiler written in Python by packetlost on Thursday June 17, 2021 @11:08AM (#27540391)
Because it's not? It has a type system but it's still duck-typed at the end of the day, and no amount of Mypy will change that.
Re:Nuitka: a Python compiler written in Python by adsharma on Thursday June 17, 2021 @11:30AM (#27540673)
It should still be possible to use the python syntax and a reimplemented stdlib to build a statically typed, typesafe variant.

I think you object to the name python3, because there is a duck typed interpreter that's popular.

Re:Nuitka: a Python compiler written in Python by packetlost on Thursday June 17, 2021 @11:38AM (#27540789)
You fundamentally cannot build a statically typed variant of Python without cutting portions of the stdlib, most notably `mock.patch`. You could do a good majority of it, probably enough to be completely usable, but at what point does it stop being Python? Go use Nim if you want statically typed Python-ish syntax.
Re:Nuitka: a Python compiler written in Python by adsharma on Thursday June 17, 2021 @01:33PM (#27542169)
py2many transpiles py3 to nim. Think of python as a way to interpret nim code if you like, with a large installed base of existing libraries.

There is demand for iterative creation of software: first get the logic out with the least friction and then think about types, resource leaks, good software engineering practices etc.

Re:Nuitka: a Python compiler written in Python by goodpoint on Friday June 18, 2021 @08:58AM (#27549808)
Re:Nuitka: a Python compiler written in Python by adsharma on Saturday June 19, 2021 @07:02PM (#27565327)
https://github.com/adsharma/py2many

  pip3 install py2many
  py2many --nim=1 foo.py
Re:Nuitka: a Python compiler written in Python by hermitdev on Friday June 18, 2021 @01:32PM (#27552752)
Type safety and static typing are orthogonal. Both C and C++ are statically typed, yet are not type safe, for instance.
Re:Nuitka: a Python compiler written in Python by metasyn on Thursday June 17, 2021 @11:17AM (#27540514)
nim-lang.org might interest you!
Re:Nuitka: a Python compiler written in Python by throwaway894345 on Thursday June 17, 2021 @04:11PM (#27544029)
Note that type safety typically means better tooling that what Python people are used to. If you’ve only used Python you have no idea what you’re missing out on with respect to refactoring, editor integrations, documentation generation, etc. And then there is the actual documentation for humans that is guaranteed to be correct and up to date so long as your build is green.
Re:Nuitka: a Python compiler written in Python by ibic on Thursday June 17, 2021 @11:16AM (#27540504)
Agree, just that ML-family languages take quite long for an average mortal like me to grok.