News for hackers. Stuff that matters.
Re:Python Idioms in Rust by tzahola on Friday March 30, 2018 @02:34PM (#16718647)
I think it's nice that more and more languages take inspiration from the Python community.

For example, I've recently found a way to use Python-like type hints in C++. Crazy, huh? The trick is to replace "auto" with the concrete type name, e.g.:

auto x = 5;

becomes:

int x = 5;

Re:Python Idioms in Rust by tathougies on Saturday March 31, 2018 @11:08AM (#16723597)
This is a joke right?
Re:Python Idioms in Rust by tzahola on Saturday March 31, 2018 @01:33PM (#16724210)
Joke? No, you can actually do this in C++!
Re:Python Idioms in Rust by tathougies on Saturday March 31, 2018 @02:21PM (#16724423)
Of course you can do this in c++. The second form of your declaration is the standard way of doing things. How did you learn c++, that this was a surprise to you?

Secondly, that’s not a ‘type hint’ and c++ did not get this from python. Prior to c++17, there was no auto and all declarations were like this. If anything, Python got the names from c++