Re: [Python-ideas] Objectively Quantifying Readability

2018-05-02 Thread Greg Ewing
Tim Peters wrote: def objective_readability_score(text): "Return the readability of `text`, a float in 0.0 .. 1.0" return 2.0 * text.count(":=") / len(text) A useful-looking piece of code, but it could be more readable. It only gives itself a readability score of 0.0136986301369863. --

Re: [Python-ideas] Objectively Quantifying Readability

2018-05-01 Thread Dan Sommers
On Wed, 02 May 2018 05:08:41 +1000, Steven D'Aprano wrote: > The difference was that when Windows users used the mouse, even though > they were *objectively* faster to complete the task compared to using > the arrow keys, subjectively they swore that they were slower, and > were *very confident* a

Re: [Python-ideas] Objectively Quantifying Readability

2018-05-01 Thread Mikhail V
On Wed, May 2, 2018 at 4:03 AM, Matt Arcidy wrote: > On Tue, May 1, 2018 at 5:35 PM, Mikhail V wrote: > >> to be pedantic - ReallyLongDescriptiveIdentifierNames >> has also an issue with "I" which might confuse because it >> looks same as little L. Just to illustrate that choice of >> comparison

Re: [Python-ideas] Objectively Quantifying Readability

2018-05-01 Thread CFK
Matt, you took the words right out of my mouth! The fonts that are being used will have a big difference in readability, as will font size, foreground and background coloring, etc. It would be interesting to see if anyone has done a serious study of this type though, especially if they studied it

Re: [Python-ideas] Objectively Quantifying Readability

2018-05-01 Thread Matt Arcidy
On Tue, May 1, 2018 at 5:35 PM, Mikhail V wrote: > to be pedantic - ReallyLongDescriptiveIdentifierNames > has also an issue with "I" which might confuse because it > looks same as little L. Just to illustrate that choice of > comparison samples is very sensitive thing. > In such a way an experie

Re: [Python-ideas] Objectively Quantifying Readability

2018-05-01 Thread Mikhail V
On Tue, May 1, 2018 at 6:04 PM, Jacco van Dorp wrote: > 2018-05-01 14:54 GMT+02:00 Greg Ewing : >> Rhodri James wrote: >>> >>> I'd be interested to know if there is a readability difference between >>> really_long_descriptive_identifier_name and >>> ReallyLongDescriptiveIdentifierNames. >> >> >> A

Re: [Python-ideas] Objectively Quantifying Readability

2018-05-01 Thread Mikhail V
On Tue, May 1, 2018 at 3:42 AM, Steven D'Aprano wrote: > On Mon, Apr 30, 2018 at 11:28:17AM -0700, Matt Arcidy wrote: > > - people are not good judges of readability; People are the only judges of readability. Just need the right people. ___ Python-idea

Re: [Python-ideas] Objectively Quantifying Readability

2018-05-01 Thread Steven D'Aprano
On Tue, May 01, 2018 at 03:02:27PM +, Dan Sommers wrote: > >> I happen to be an excellent judge of whether a given block of code is > >> readable to me. > > > In the same way that 93% of people say that they are an above-average > > driver, I'm sure that most people think that they are an exc

Re: [Python-ideas] Objectively Quantifying Readability

2018-05-01 Thread Tim Peters
Objectively quantifying is easy. For example, def objective_readability_score(text): "Return the readability of `text`, a float in 0.0 .. 1.0" return 2.0 * text.count(":=") / len(text) Then >>> objective_readability_score("if value:") 0.0 >>> objective_readability_score("if value := f()

Re: [Python-ideas] Objectively Quantifying Readability

2018-05-01 Thread Nathaniel Smith
On Tue, May 1, 2018, 02:55 Matt Arcidy wrote: > > I am not inferring causality when creating a measure. No, but when you assume that you can use that measure to *make* code more readable, then you're assuming causality. Measuring the > temperature of a steak doesn't infer why people like it me

Re: [Python-ideas] Objectively Quantifying Readability

2018-05-01 Thread Eric Fahlgren
On Tue, May 1, 2018 at 8:04 AM, Jacco van Dorp wrote: > 2018-05-01 14:54 GMT+02:00 Greg Ewing : > > Rhodri James wrote: > >> > >> I'd be interested to know if there is a readability difference between > >> really_long_descriptive_identifier_name and > >> ReallyLongDescriptiveIdentifierNames. > >

Re: [Python-ideas] Objectively Quantifying Readability

2018-05-01 Thread Jacco van Dorp
2018-05-01 14:54 GMT+02:00 Greg Ewing : > Rhodri James wrote: >> >> I'd be interested to know if there is a readability difference between >> really_long_descriptive_identifier_name and >> ReallyLongDescriptiveIdentifierNames. > > > As one data point on that, jerking my eyes quickly across > that l

Re: [Python-ideas] Objectively Quantifying Readability

2018-05-01 Thread Dan Sommers
On Tue, 01 May 2018 22:37:11 +1000, Steven D'Aprano wrote: > On Tue, May 01, 2018 at 04:50:05AM +, Dan Sommers wrote: >> On Tue, 01 May 2018 10:42:53 +1000, Steven D'Aprano wrote: >> >> > - people are not good judges of readability; >> I happen to be an excellent judge of whether a given blo

Re: [Python-ideas] Objectively Quantifying Readability

2018-05-01 Thread Greg Ewing
Rhodri James wrote: I'd be interested to know if there is a readability difference between really_long_descriptive_identifier_name and ReallyLongDescriptiveIdentifierNames. As one data point on that, jerking my eyes quickly across that line I found it much easier to pick out the component word

Re: [Python-ideas] Objectively Quantifying Readability

2018-05-01 Thread Steven D'Aprano
On Tue, May 01, 2018 at 04:50:05AM +, Dan Sommers wrote: > On Tue, 01 May 2018 10:42:53 +1000, Steven D'Aprano wrote: > > > - people are not good judges of readability; > > WTF? By definition, people are the *only* judge of readability.¹ We're discussing an actual study that attempted, with

Re: [Python-ideas] Objectively Quantifying Readability

2018-05-01 Thread Rhodri James
On 01/05/18 01:42, Steven D'Aprano wrote: That's a really nice study, and thank you for posting it. Seconded! There are some interested observations here, e.g.: - line length is negatively correlated with readability; (a point against those who insist that 79 character line limits are

Re: [Python-ideas] Objectively Quantifying Readability

2018-05-01 Thread Matt Arcidy
On Tue, May 1, 2018 at 1:29 AM, Nathaniel Smith wrote: > On Mon, Apr 30, 2018 at 8:46 PM, Matt Arcidy wrote: >> On Mon, Apr 30, 2018 at 5:42 PM, Steven D'Aprano wrote: >>> (If we know that, let's say, really_long_descriptive_identifier_names >>> hurt readability, how does that help us judge whet

Re: [Python-ideas] Objectively Quantifying Readability

2018-05-01 Thread Antoine Pitrou
Yes, it seems that this study has many limitations which don't make its results very interesting for our community. I think the original point was that readability *can* be studied rationnally and scientifically, though. Regards Antoine. On Tue, 1 May 2018 09:00:44 +0200 Jacco van Dorp wrote

Re: [Python-ideas] Objectively Quantifying Readability

2018-05-01 Thread Nathaniel Smith
On Mon, Apr 30, 2018 at 8:46 PM, Matt Arcidy wrote: > On Mon, Apr 30, 2018 at 5:42 PM, Steven D'Aprano wrote: >> (If we know that, let's say, really_long_descriptive_identifier_names >> hurt readability, how does that help us judge whether adding a new kind >> of expression will hurt or help read

Re: [Python-ideas] Objectively Quantifying Readability

2018-05-01 Thread Jacco van Dorp
I must say my gut agrees that really_long_identifier_names_with_a_full_description don't look readable to me. Perhaps it's my exposure to (py)Qt, but I really like my classes like ThisName and my methods like thisOne. I also tend to keep them to three words max (real code from yesterday: getActiveO

Re: [Python-ideas] Objectively Quantifying Readability

2018-04-30 Thread Dan Sommers
On Tue, 01 May 2018 10:42:53 +1000, Steven D'Aprano wrote: > - people are not good judges of readability; WTF? By definition, people are the *only* judge of readability.¹ I happen to be an excellent judge of whether a given block of code is readable to me. OTOH, if you mean is that I'm a bad j

Re: [Python-ideas] Objectively Quantifying Readability

2018-04-30 Thread Matt Arcidy
On Mon, Apr 30, 2018 at 5:42 PM, Steven D'Aprano wrote: > On Mon, Apr 30, 2018 at 11:28:17AM -0700, Matt Arcidy wrote: > >> A study has been done regarding readability in code which may serve as >> insight into this issue. Please see page 8, fig 9 for a nice chart of >> the results, note the negat

Re: [Python-ideas] Objectively Quantifying Readability

2018-04-30 Thread Chris Angelico
On Tue, May 1, 2018 at 10:42 AM, Steven D'Aprano wrote: > The conclusion here is that if you want readable source code, you should > remove the source code. *wink* That's more true than your winky implies. Which is more readable: a Python function, or the disassembly of its corresponding byte-cod

Re: [Python-ideas] Objectively Quantifying Readability

2018-04-30 Thread Steven D'Aprano
On Mon, Apr 30, 2018 at 11:28:17AM -0700, Matt Arcidy wrote: > A study has been done regarding readability in code which may serve as > insight into this issue. Please see page 8, fig 9 for a nice chart of > the results, note the negative/positive coloring of the correlations, > grey/black respect

[Python-ideas] Objectively Quantifying Readability

2018-04-30 Thread Matt Arcidy
The number and type of arguments about readability as a justification, or an opinion, or an opinion about an opinion seems counter-productive to reaching conclusions efficiently. I think they are very important either way, but the justifications used are not rich enough in information to be very u