News for hackers. Stuff that matters.
Re:Pyre: Fast Type Checking for Python by Buttons840 on Friday May 11, 2018 @05:49PM (#17051014)
I keep a mental list of the qualities of good code, "short" and "readable" are on the list. I've sometimes wondered whether "short" or "readable" should be placed higher on the list, and I eventually decided that short code is better than readable code because the shortness of code is objectively measurable. We can argue all day over whether `[x+1 for x in xs]` is more or less readable than a for-loop variant, but it is objectively shorter.

Of course, it's like food and water, you want both all the time, but in a hard situation you prioritize water. Likewise, in hard times, where I'm not quite sure what is most readable, I will choose what is shortest.

Re:Pyre: Fast Type Checking for Python by rxhernandez on Saturday May 12, 2018 @12:22AM (#17052455)
> I eventually decided that short code is better than readable code because the shortness of code is objectively measurable

I can debug sophisticated algorithms code that is readable and explicit far more easily than short and concise. Anyone that tells you otherwise has never had to debug the legacy optimization algorithms of yesteryear (nor have they seen the ample amount of nested parens that comes from a bullshit philosophy of keeping the code as short as possible).

Re:Pyre: Fast Type Checking for Python by heavenlyblue on Saturday May 12, 2018 @08:04AM (#17053645)
All arguments about computer languages will always end up in disagreement, since every person in that argument does programming in an entirely different context.

Short is good when the average half-life of your code is less than a month.

When you're writing something for 10 years and beyond - it makes sense to have something incredibly sophisticated and explicit.

Otherwise it doesn't since the amount of time it takes me to comprehend all of the assumptions you made in all of those nested for loops is probably longer that the lifetime of the code in production.

List comprehension has a nice, locally-defined property in python: it will always terminate.

Re:Pyre: Fast Type Checking for Python by joshuamorton on Monday May 14, 2018 @12:22AM (#17062658)
Only if you iterate over a fixed-length iterable.

    [x for x in itertools.count()]
will never terminate.
Re:Pyre: Fast Type Checking for Python by heavenlyblue on Wednesday May 23, 2018 @01:06PM (#17135809)
It will terminate as soon as it runs out of memory.
Re:Pyre: Fast Type Checking for Python by joshuamorton on Wednesday May 23, 2018 @01:13PM (#17135889)
By this definition, python has a nice locally defined property that it will always terminate ;)
Re:Pyre: Fast Type Checking for Python by heavenlyblue on Thursday May 24, 2018 @09:12AM (#17143601)
No; this will never-ever terminate:

    (x for x in itertools.count())
Re:Pyre: Fast Type Checking for Python by ethbro on Saturday May 12, 2018 @10:58AM (#17054326)
Obligatory Dijkstra: "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it."
Re:Pyre: Fast Type Checking for Python by catnaroek on Friday May 18, 2018 @07:55PM (#17105815)
That's actually Brian Kernighan. Dijkstra would have never advocated debugging to begin with.
Re:Pyre: Fast Type Checking for Python by dorfsmay on Saturday May 12, 2018 @12:42AM (#17052509)
So you must be a fan of obfuscated C contests?

The main reason list comp in python were given so much praise is because how they are (were?) More efficient than loops. I personally find a series of generator expressions followed by a list comp more readable than a three-level list comprehension, although the latter is more readable.