News for hackers. Stuff that matters.
Re:PEP 526: Variable declaration in Python by toyg on Thursday August 11, 2016 @06:15AM (#12267114)
A very sad day. We were told type hints were just that, optional hints to help IDEs and such. Now they're creeping into the language proper; IDEs will start adding them for you, and before you know it all "serious codebases" will be statically typed.

The beauty of python was that it could read like pseudocode; more and more special characters and notations are putting that idea to rest. I guess it's the price to pay for mainstream success -- when banks get involved, everything becomes uber-formal and soul-crushing.

Re:PEP 526: Variable declaration in Python by dozzie on Thursday August 11, 2016 @06:22AM (#12267140)
> [...] before you know it all "serious codebases" will be statically typed.

And this is bad because...?

Re:PEP 526: Variable declaration in Python by raverbashing on Thursday August 11, 2016 @06:44AM (#12267203)
And this is good because?

You want Java you use Java. Oh it sucks? I wonder why...

Oh even better, you set a type, does it prevent you from using things with a similar interface? Like iterables in place of lists?

Re:PEP 526: Variable declaration in Python by dozzie on Thursday August 11, 2016 @07:03AM (#12267255)
> And this is good because?

Better code documentation? Static analysis? Compare to Erlang with typespecs and Dialyzer.

> You want Java you use Java.

Why Java? Why not SML, OCaml, Haskell, Rust? Those are statically typed languages, too.

> Oh it [Java] sucks? I wonder why...

Because it's statically typed yet it's dynamically typed ("Object" class thing)? Because its type system is quite primitive and somewhat inconsent? Because it was designed for use in TV sets two dozens years ago, and has barely advanced as a language since then? (No, foreach loops and lambdas don't qualify as a significant step, those are merely syntax sugar.)

> Oh even better, you set a type, does it prevent you from using things with a similar interface? Like iterables in place of lists?

Type specification signifies code author's intent. This is a very good thing, and I want to see it much more in the code. I don't expect type specs/hints to do anything more for a dynamically typed language.

Re:PEP 526: Variable declaration in Python by raverbashing on Thursday August 11, 2016 @07:37AM (#12267367)
> Haskell, Rust? Those are statically typed languages, too.

Developers on those languages usually don't push for crap like the Java developers do

And I don't want to use Rust or Haskell where Python can solve the problem just fine. Overhead and development time is also a problem

Type hints add development time and bureaucracy. The 80 columns limit was supposed to be a guidance as well but now it has become almost mandatory

Re:PEP 526: Variable declaration in Python by dozzie on Thursday August 11, 2016 @09:44AM (#12268125)
>> Haskell, Rust? Those are statically typed languages, too.

> [...] I don't want to use Rust or Haskell where Python can solve the problem just fine. Overhead and development time is also a problem

Yet you suggested using Java. Something in your comments seems inconsistent.

> Type hints add development time and bureaucracy.

That's why they are (going to be) optional. But for larger codebases beaurocracy adds some structure, which can be beneficial.

BTW, did you know that beaurocracy was an invention of ancient times? Yes, an invention. It allowed citizens to know what to do with their requests to authorities. Beaurocracy is generally a desired thing, it's excessive beaurocracy that is awful.

Re:PEP 526: Variable declaration in Python by pjmlp on Thursday August 11, 2016 @08:20AM (#12267582)
> The 80 columns limit was supposed to be a guidance as well but now it has become almost mandatory

Only for those whose pinnacle of programming editors are from a VT-100 era.

Re:PEP 526: Variable declaration in Python by raverbashing on Thursday August 11, 2016 @08:27AM (#12267628)
Yes, it is mandatory. People just use pep8 utility as a linter and block the code being committed/tested if it doesn't adhere to that

Because thinking and reading the first phrase of PEP 8 is too hard, cargo culting is easier.

Re:PEP 526: Variable declaration in Python by toyg on Thursday August 11, 2016 @06:25AM (#12267146)
because they will lose readability and raise the bar for contribution from novices. Every extra feature you add to the language requires extra effort to read and extra effort from novices to understand.
Re:PEP 526: Variable declaration in Python by singhblom on Thursday August 11, 2016 @06:43AM (#12267199)
I don't know about this. My feeling from working with Typescript and Javascript is that the type hints really help people understand what is happening. My background is as a Python programmer, but Typescript really convinced me that optional type hints are a super-valuable addition to a dynamic language. Most of my docstrings in python tend to be type annotations anyway -- might as well make it possible for tools to support it easily.
Re:PEP 526: Variable declaration in Python by yedpodtrzitko on Thursday August 11, 2016 @06:40AM (#12267191)
"Readability" depends on a context. I've worked with a huge codebases where having a variable types attached to the variables there would actually improve the readability. Sure, it would take you a moment longer to skim the line, but overall it would save you a much more time to figure out what's the variable about.
Re:PEP 526: Variable declaration in Python by 2T1Qka0rEiPr on Thursday August 11, 2016 @06:43AM (#12267200)
@dozzie, I don't think static typing does make it easier to read, it makes it more verbose.
Re:PEP 526: Variable declaration in Python by catnaroek on Thursday August 11, 2016 @07:34AM (#12267360)
Are you confusing “static typing” with “type annotations”? You can write large swathes of statically typed code without a single type annotation, in languages with proper type inference. This is 70's-era technology, mind you.
Re:PEP 526: Variable declaration in Python by 2T1Qka0rEiPr on Thursday August 11, 2016 @10:45AM (#12268609)
You're right, I'm conflating the two, though I appreciate that one doesn't require the other.
Re:PEP 526: Variable declaration in Python by dozzie on Thursday August 11, 2016 @06:39AM (#12267187)
>>> [...] before you know it all "serious codebases" will be statically typed.

> because they will lose readability and raise the bar for contribution from novices

OK, hold for a second. Adding something to make the code easier to follow will make code harder to follow? Is this really your argument?

And why would a novice to a language want to contribute to "serious codebase"? I don't think Django, Jinja, or NumPy are popular for Python novices to contribute code.