DEV Community

Nguyen Kim Son
Nguyen Kim Son

Posted on

What would you want the most in Python 4?

Now that python 3 has hit 3.8 we can expect that python 4 will come out pretty soon.

Please put in the comment the most important single feature that you wish python 4 will have.

To start, for me it would be a stricter typing: typing is currently just a hint and not enforced in runtime. In a big project it helps a lot to have typing for everything (variables, functions).

Would be perfect if python can have a static typing mode that enforces this.

Top comments (12)

Collapse
 
sonnk profile image
Nguyen Kim Son

I think the function here is rather canConvertToInt (or can_convert_to_int according to PEP8 πŸ˜…).
The int(val) works for both val=1 and val="1". If you want simply to test whether a variable is int, type(val)==int should be enough.

Collapse
 
wrldwzrd89 profile image
Eric Ahnell

Python 3.8 gets a heck of a lot closer by putting the relevant typing module in the standard library, so you can leverage it much more easily. That being said... the biggest thing Python needs right now is architectural improvements in multiprocessing. So many things people do with Python benefit from multiple cores, and Python can't yet take full advantage of them.

Collapse
 
sonnk profile image
Nguyen Kim Son

In order to take advantage of multi core, it seems that Python developers often use native binding libraries like Cython and hardly take use of the multiprocessing package. For IO bound applications, asyncio is usually the solution.

Collapse
 
pykashchain profile image
Pykash

fastest as java.

Collapse
 
sonnk profile image
Nguyen Kim Son

To speed up Python, Cython can be a good option as we can mix C and Python code. We used to call 3D C++ functions from Python with Cython and the performance is on par with pure C++.

Collapse
 
yoadev profile image
Younes

i++ !

Collapse
 
evanroggenkamp profile image
Evan Roggenkamp • Edited

Hey you might be interested in mypy

Collapse
 
casualcoder profile image
Casual Coder

Get rid of GIL

Collapse
 
jheld profile image
Jason Held

Have you had experiences where the GIL was the limiting factor on the runtime performance?

There are PEPs open now to help with this (including an overhauled subinterpreters implementation).

Collapse
 
casualcoder profile image
Casual Coder

No, never reached that stage honestly

Collapse
 
fultonbrowne profile image
Fulton Browne

I think python 4 along with any other new version of a programming language should have multiple targets like kotlin and haxe have.

 
sonnk profile image
Nguyen Kim Son

They are indeed similar. I think Cython users will tend to write custom C code whereas JNA is more about using existing code without modifying it but I might be wrong.