News for hackers. Stuff that matters.
Re:Python has brought computer programming to a vast new aud... by tomnipotent on Thursday July 19, 2018 @05:49PM (#17570616)
> There seems to be a sentiment that Python is a kids language

I only hear this from developers that have never used Python or work in problem domains where the language is genuinely not better (e.g. low-latency distributed services, embedded devices/IoT sensors).

I've scaled Python & PHP web apps to a hundred million monthly visitors on Top 20 US destinations on very limited hardware (6-10 machines). It's surprising how much you can get out of the language if you know how to take advantage of the strengths.

Re:Python has brought computer programming to a vast new aud... by antt on Thursday July 19, 2018 @06:21PM (#17570853)
Even IoT sensors are easier to program with micropython.

What I find worrying is the the language is changing to suit those people, e.g. type hints, rather than teaching them learning to use the language. You don't complain you can't use a hammer as a screw driver, you just don't use a hammer.

Re:Python has brought computer programming to a vast new aud... by StavrosK on Thursday July 19, 2018 @07:47PM (#17571353)
I agree that sensors are easier with Micropython and will use that if I can (unfortunately the C++/Arduino ecosystem is much, much larger). However, type hints are a fantastic feature and I can't recommend them enough to anyone who writes software for a living. It makes maintenance at least an order of magnitude easier.
Re:Python has brought computer programming to a vast new aud... by antt on Thursday July 19, 2018 @08:06PM (#17571442)
1). C++/Arduino for micro controllers ends up using more memory than micropython. I've managed to get the binary sizes to 1/4 by doing cross compiles and linking things my self.

2). Types hints are a terrible non-pythonic kludge to solve a people problem in code. People who want to write java with whitespace and no curly brackets love them. CPython has made a number of bad decisions lately that make the language less usable. I've moved quite a bit of my everyday code to PyPy. Since they eat their own dog food they are keeping their dialect sane.

Re:Python has brought computer programming to a vast new aud... by StavrosK on Thursday July 19, 2018 @08:23PM (#17571504)
Type hints are optional, why not just not use them?

How are you going to know the type of an object that gets passed to a function? Why is it better to go around the codebase looking for things instead of glancing at the function signature?

Re:Python has brought computer programming to a vast new aud... by antt on Thursday July 19, 2018 @08:37PM (#17571561)
The type (class really) of an object tells you nothing about how it will behave. What you need to do is check the methods attached to the object, not class, at runtime:

1) Exist.

2) Behave how you want them to behave.

I've written plenty of code that got that done by using an assert just after the docstring.

People will monkey patch, if not in your code base, than in a library you're importing.

Re:Python has brought computer programming to a vast new aud... by tomnipotent on Thursday July 19, 2018 @08:20PM (#17571491)
> Types hints are a terrible non-pythonic kludge to solve a people problem in code.

I have a love/hate relationship with type hinting in Python. I've been using them for about 2 years, and it still just feels... unnatural. I usually add enough so that my IDE (PyCharm) has better autocomplete and that any Sphinx generated docs have sufficient coverage of types I may have missed when adding @params.

Re:Python has brought computer programming to a vast new aud... by antt on Thursday July 19, 2018 @08:46PM (#17571614)
I have mostly a hate relationship with them, because the people who use them do not write python. They write c# or java in python.

And you shouldn't need an IDE with a scripting language. That one of the main selling points for type hints has been "Your IDE will do things for you!" is a warning that this is a bad move. Again python is not java, and it shouldn't be trying to be java.