r/programming • • Jul 31 '15

Guido on Python

https://lwn.net/Articles/651967/
157 Upvotes

143 comments sorted by

View all comments

7

u/[deleted] Jul 31 '15

I wish someone would write a "modern python". Something similar to Python in terms of syntax (but ban spaces for indentation) and expressiveness, but with a sane type system (less like javascript), better performance, and the whole GIL thing fixed.

19

u/[deleted] Jul 31 '15

So, Nim?

5

u/[deleted] Jul 31 '15

Yeah actually Nim looks pretty close to what I described!

13

u/cdsboy Jul 31 '15

If I had a strictly typed, immutable, tabs banned ;) python I'd switch to it in a heart beat.

11

u/def- Jul 31 '15

You might like Nim: http://nim-lang.org/

5

u/cdsboy Jul 31 '15

I've played around with it. It's pretty cool.

→ More replies (17)

6

u/the_omega99 Jul 31 '15

One feature I would like is a consistent OOP API. Why is it len(foo) instead of foo.length(), yet foo.append(bar) instead of append(foo, bar)? IMO, that's a big annoyance and there's a bunch of cases like that. It's especially weird since the internals use OOP, with foo.__len__() being called.

I wish they had changed those in Python 3.

As an aside, while I like the user of indentation for scope, it has one major downfall and that's lambdas. Python has no multiline lambdas (the only language I know with such a restriction) and this is rather annoying for those well versed with functional programming. We end up having to make tons of named functions, which is unnecessary.

→ More replies (9)

10

u/krenzalore Jul 31 '15

Several variant interpreters have no GIL: for example Jython (Python on the JVM). Most of these intepreters are fully compatibly except in C extension modules (which Jython trades for Java/JVM compatbility).

I do not think you can get similar expressiveness with tighter type controls. Part of the expressiveness comes from these loose controls. The answer to this may well be better static analysis tools.

2

u/DGolden Jul 31 '15

Several variant interpreters have no GIL

Yeah, makes recent noise about Python moving to a TCL-style sub-interpreter model kind of irritating. It might be nice to have subinterpreters cleaned up and working anyway, but it's really only CPython, admittedly the current reference impl, with the goddamn problem...

Jython is fine, and can easily be used for server stuff like django.

5

u/yogthos Jul 31 '15

so basically Clojure then :P

8

u/engineeringMind Jul 31 '15

It's not quite what you want, but take a look at Nim

8

u/kyllo Jul 31 '15

Haskell is a better Python in a lot of ways. It's high-level, expressive, and offers a sane type system (once you learn a few big words), near-C performance, and an excellent concurrency story. It also uses indentation over curly braces, like Python.

2

u/[deleted] Aug 01 '15

I tried to learn Haskell but found the strictly functional style too restrictive. I'm with John Carmack on the pragmatism scale.

→ More replies (1)

5

u/kirbyfan64sos Jul 31 '15

Kind of like Nim? Other than the fact that tabs are disallowed, it's very similar to Python syntactically and has very good performance.

2

u/yatpay Jul 31 '15

As someone who's either come around or been brainwashed on the tabs/spaces thing (since I can have Vim just treat the four spaces like they're a tab), why is this important?

→ More replies (37)

2

u/zarandysofia Jul 31 '15

Lua, Scheme, Clojure, Elixir, SmallTalk, Golang (some time in the future when generics are available).

3

u/hairlesscaveman Jul 31 '15

There's Cobra if you're working on the .Net platform, the language seems pretty nice and very pythonic and has Design-by-Contract built in. There was mention of it being ported to the JVM, but I've not heard of any recent progress. I'd absolutely give it a go on the JVM.

There's Nim, too. I've not played with it much, but it looks nice and is gaining traction.

I've always wondered whether it'd be possible to tweak the OCaml interpreter to allow it to take more pythonic syntax, but follow OCaml's type rules. Jocaml's interpreter could be used to allow concurrency.

3

u/[deleted] Jul 31 '15

There was Boo which basically was static typed python on .net infrastructure.

It's pretty dead now, which is a shame.

Oh, well, at least there is still crystal - ruby with types. And since it compiles to native code, I have no idea if it sorted out GIL.

They use BoehmGC, so even if they have actual threads, they might have problems which old Go's GC had: not freeing memory because floats look like pointers.

3

u/TheJimiHat Jul 31 '15

If you're looking for something like Python but want tabs rather than spaces, and something less explicit, why not try out Ruby?

11

u/Akkuma Jul 31 '15

He also asked for better performance and the GIL fixed.

2

u/iconoclaus Jul 31 '15

Then JRuby or Crystal. Or Scala or something. So many choices nowadays.

2

u/Ran4 Jul 31 '15

Why? There's so much python code out there, and python in general works great, with few exceptions.

What you want is a different implementation. For which there are multiple choices already.

If you want speed, a language as dynamic as (c)Python just won't do.

→ More replies (1)

2

u/tavert Jul 31 '15

Julia if you want a dynamic type system + JIT and are into numerics, Nim if you want to write self-contained applications.

1

u/Yojihito Aug 01 '15

I haven't used it outside of hello world but maybe Go?

→ More replies (19)