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*

Re: [Python-ideas] A "local" pseudo-function

2018-05-01 Thread Tim Peters
[MRAB] >>> Would/should it be possible to inject a name into a local scope? You can't >>> inject into a function scope, and names in a function scope can be >>> determined statically (they are allocated slots), so could the same kind of >>> thing be done for names in a local scope? ... [Steven

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

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

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. >

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

Re: [Python-ideas] A "local" pseudo-function

2018-05-01 Thread Tim Peters
[MRAB] >>> Imagine renaming the specified names that are declared 'local' >>> throughout the nested portion: >>> >>> def f(): >>> a = 10 >>> local local_a: >>> def showa(): >>> print("a is", local_a) >>> showa() # Raises NameError in showa because nothing bound

Re: [Python-ideas] A "local" pseudo-function

2018-05-01 Thread MRAB
On 2018-05-01 19:12, Tim Peters wrote: [MRAB] > Imagine renaming the specified names that are declared 'local' throughout > the nested portion: > > def f(): > a = 10 > local local_a: > def showa(): > print("a is", local_a) > showa() # Raises NameError in showa

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.

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

Re: [Python-ideas] Should __builtins__ have some kind of pass-through print function, for debugging?

2018-05-01 Thread Pradyun Gedam
On Fri, Apr 27, 2018 at 6:24 PM Nick Coghlan wrote: > On 27 April 2018 at 21:27, Steven D'Aprano wrote: > >> Obviously dp() would have to be magic. There's no way that I know of for >> a Python function to see the source code of its own arguments. I have

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

Re: [Python-ideas] A "local" pseudo-function

2018-05-01 Thread Tim Peters
[MRAB] > By "inject" I mean putting a name into a namespace: > > import my_module > my_module.foo = 'FOO' > > You can't insert a name into a function's body to make a new local variable. So you do mean at runtime, I think. Then as before, you can do that with module and the builtin

Re: [Python-ideas] A "local" pseudo-function

2018-05-01 Thread MRAB
On 2018-05-01 16:23, Steven D'Aprano wrote: On Mon, Apr 30, 2018 at 08:52:13PM -0500, Tim Peters wrote: > Would/should it be possible to inject a name into a local scope? You can't > inject into a function scope, and names in a function scope can be > determined statically (they are allocated

Re: [Python-ideas] A "local" pseudo-function

2018-05-01 Thread Steven D'Aprano
On Tue, May 01, 2018 at 09:26:09PM +1200, Greg Ewing wrote: > Steven D'Aprano wrote: > >So what was the closure? If the surrounding function was still running, > >there was no need to capture the running environment in a closure? > > You seem to be interpreting the word "closure" a bit >

Re: [Python-ideas] A "local" pseudo-function

2018-05-01 Thread MRAB
On 2018-05-01 04:40, Tim Peters wrote: [MRAB] >> Any binding that's not specified as local is bound in the parent scope: [Tim] > Reverse-engineering the example following, is this a fair way of > making that more precise? > > Given a binding-target name N in scope S, N is bound in scope T,

Re: [Python-ideas] A "local" pseudo-function

2018-05-01 Thread MRAB
On 2018-05-01 02:52, Tim Peters wrote: [MRAB ] > ... > The intention is that only the specified names are local. > > After all, what's the point of specifying names after the 'local' if _any_ > binding in the local scope was local? Don't look at me ;-) In the

Re: [Python-ideas] A "local" pseudo-function

2018-05-01 Thread Tim Peters
[Tim] > ... > Here's an example where I don't know what the consequences of "the > rules" should be: > > def f(): > a = 10 > local a: > def showa(): > print("a is", a) > showa() # 10 > a = 20 > showa() # 20 > a = 30 > showa() # 10 > >

Re: [Python-ideas] A way to subscript a single integer from bytes

2018-05-01 Thread Elazar
I think this method is easy to miss, since people look at the docs for bytes (e.g. using dir(bytes)). It might be worthwhile to either add a `bytes.to_int(...)` method (better, IMHO), or to point to int.from_bytes on the relevant part of the docs. Elazar On Tue, May 1, 2018 at 5:09 PM Ken Hilton

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

Re: [Python-ideas] A "local" pseudo-function

2018-05-01 Thread Steven D'Aprano
On Mon, Apr 30, 2018 at 08:52:13PM -0500, Tim Peters wrote: > > Would/should it be possible to inject a name into a local scope? You can't > > inject into a function scope, and names in a function scope can be > > determined statically (they are allocated slots), so could the same kind of > >

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

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

Re: [Python-ideas] A way to subscript a single integer from bytes

2018-05-01 Thread Ken Hilton
Whoops! Never seen that before. Nothing I searched up pointed me to it. Sorry for wasting your time! Ken; -- Sincerely, Ken; ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct:

Re: [Python-ideas] A way to subscript a single integer from bytes

2018-05-01 Thread Steven D'Aprano
On Tue, May 01, 2018 at 07:22:52PM +0800, Ken Hilton wrote: > The only way to get 493182234161465432041076 out of b'hovercraft' You seem to be using a bytes object as a base-256 number. Under what circumstances is this desirable? > in a single expression is as follows: What's so special

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

Re: [Python-ideas] A way to subscript a single integer from bytes

2018-05-01 Thread Antoine Pitrou
Hi Ken, On Tue, 1 May 2018 19:22:52 +0800 Ken Hilton wrote: > > So I'm pretty sure everyone here is familiar with how the "bytes" object > works in Python 3. It acts mostly like a string, with the exception that > 0-dimensional subscripting (var[idx]) returns an integer,

[Python-ideas] A way to subscript a single integer from bytes

2018-05-01 Thread Ken Hilton
Hi all, So I'm pretty sure everyone here is familiar with how the "bytes" object works in Python 3. It acts mostly like a string, with the exception that 0-dimensional subscripting (var[idx]) returns an integer, not a bytes object - the integer being the ordinal number of the corresponding

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,

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

Re: [Python-ideas] A "local" pseudo-function

2018-05-01 Thread Greg Ewing
Steven D'Aprano wrote: So what was the closure? If the surrounding function was still running, there was no need to capture the running environment in a closure? You seem to be interpreting the word "closure" a bit differently from most people. It doesn't imply anything about whether a

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

Re: [Python-ideas] A "local" pseudo-function

2018-05-01 Thread Steven D'Aprano
On Tue, May 01, 2018 at 06:06:06PM +1200, Greg Ewing wrote: > Steven D'Aprano wrote: > >Pascal, for example, had lexical scoping back in the 1970s, but > >no closures. > > Well, it kind of had a limited form of closure. You could pass > a procedure or function *in* to another procedure or

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:

Re: [Python-ideas] A "local" pseudo-function

2018-05-01 Thread Greg Ewing
Steven D'Aprano wrote: Pascal, for example, had lexical scoping back in the 1970s, but no closures. Well, it kind of had a limited form of closure. You could pass a procedure or function *in* to another procedure or function as a parameter, but there was no way to return one or pass it out in