[Python-ideas] Re: Amend PEP-8 to require clear, understandable comments instead of Strunk & White Standard English comments

2020-06-26 Thread David Mertz
My point is that _Elements of Style_ is not a set of rules. It's a nice book with generally good advice; it's not a style guide in a formal sense. If we wanted rules, _The Chicago Manual of Style_ or the_Associated Press Style Guide_ would be much closer to that. But neither of those actually

[Python-ideas] Re: Amend PEP-8 to require clear, understandable comments instead of Strunk & White Standard English comments

2020-06-26 Thread Steven D'Aprano
On Sat, Jun 27, 2020 at 12:37:35AM -0400, David Mertz wrote: > Objectively, could I have dropped "most"? Both "most famous"? > > Could you have dropped "still," objectively? Yes, we probably could have. What's your point? I'm not arguing in favour of S here on this mailing list, and I've

[Python-ideas] Re: Amend PEP-8 to require clear, understandable comments instead of Strunk & White Standard English comments

2020-06-26 Thread Chris Angelico
On Sat, Jun 27, 2020 at 2:44 PM Soni L. wrote: > > > Take word out of sentence, does sentence still mean same? Then word > needless. Is objective test. That sounds like the way the Heavy Weapons Guy talks (when he speaks English - his native language is Russian). What you've done is make a

[Python-ideas] Re: Amend PEP-8 to require clear, understandable comments instead of Strunk & White Standard English comments

2020-06-26 Thread Soni L.
On 2020-06-27 1:33 a.m., Steven D'Aprano wrote: On Fri, Jun 26, 2020 at 11:36:47PM -0400, David Mertz wrote: > On Fri, Jun 26, 2020, 8:40 PM Steven D'Aprano wrote: > > > "Clear and easily understandable" is subjective. What is clear and > > understandable to me may be impenetrably

[Python-ideas] Re: giving set.add a return value

2020-06-26 Thread Chris Angelico
On Sat, Jun 27, 2020 at 2:29 PM Steven D'Aprano wrote: > Seriously, I genuinely thought that the existing behaviour was the > opposite and that `add` unconditionally added the element. "Last seen > wins". If I was designing sets, that's probably how I would design it. > After all, it's called

[Python-ideas] Re: Amend PEP-8 to require clear, understandable comments instead of Strunk & White Standard English comments

2020-06-26 Thread David Mertz
Objectively, could I have dropped "most"? Both "most famous"? Could you have dropped "still," objectively? On Sat, Jun 27, 2020, 12:34 AM Steven D'Aprano wrote: > On Fri, Jun 26, 2020 at 11:36:47PM -0400, David Mertz wrote: > > On Fri, Jun 26, 2020, 8:40 PM Steven D'Aprano > wrote: > > > > >

[Python-ideas] Re: Amend PEP-8 to require clear, understandable comments instead of Strunk & White Standard English comments

2020-06-26 Thread Steven D'Aprano
On Fri, Jun 26, 2020 at 11:36:47PM -0400, David Mertz wrote: > On Fri, Jun 26, 2020, 8:40 PM Steven D'Aprano wrote: > > > "Clear and easily understandable" is subjective. What is clear and > > understandable to me may be impenetrably confusing to others, or > > obnoxiously dumbed down. > > > >

[Python-ideas] Re: giving set.add a return value

2020-06-26 Thread Steven D'Aprano
On Fri, Jun 26, 2020 at 06:16:05AM -0500, Dan Sommers wrote: > >already_there = seen.add(element) > >if already_there: > ># handle the duplicate case > > > >Who thinks like that? *wink* > > Anyone who practices EAFP rather than LBYL? Or is that why you're > winking? That

[Python-ideas] Re: Amend PEP-8 to require clear, understandable comments instead of Strunk & White Standard English comments

2020-06-26 Thread David Mertz
On Fri, Jun 26, 2020, 8:40 PM Steven D'Aprano wrote: > "Clear and easily understandable" is subjective. What is clear and > understandable to me may be impenetrably confusing to others, or > obnoxiously dumbed down. > Strunk and White's most famous mandate of "omit needless words" is likewise

[Python-ideas] Re: Amend PEP-8 to require clear, understandable comments instead of Strunk & White Standard English comments

2020-06-26 Thread Kyle Stanley
I can't say that I've ever assessed the quality of a code comment based on how well it adheres to Strunk & White, nor have I ever been involved with an environment that tries to strongly enforce that specific style of writing. So FWIW, I agree that "clear and concise English" is more relevant to

[Python-ideas] Re: Amend PEP-8 to require clear, understandable comments instead of Strunk & White Standard English comments

2020-06-26 Thread Guido van Rossum
Steven just likes an argument. Nobody has ever taken the idea of a standard for language in comments seriously. It Just doen come up. On Fri, Jun 26, 2020 at 18:35 Bernardo Sulzbach < berna...@bernardosulzbach.com> wrote: > On Fri, Jun 26, 2020 at 9:43 PM Steven D'Aprano > wrote: > >> I dislike

[Python-ideas] Re: Allow signal suppression

2020-06-26 Thread Yonatan Zunger via Python-ideas
Hmm, interesting thought! I'll try that out. Thanks! On Fri, Jun 26, 2020, 01:51 Antoine Pitrou wrote: > On Thu, 25 Jun 2020 18:32:48 -0700 > Yonatan Zunger via Python-ideas > wrote: > > > > So that's an example of why you might find yourself in such a situation > in > > userland. And

[Python-ideas] Re: Amend PEP-8 to require clear, understandable comments instead of Strunk & White Standard English comments

2020-06-26 Thread Bernardo Sulzbach
On Fri, Jun 26, 2020 at 9:43 PM Steven D'Aprano wrote: > I dislike Strunk and White, and don't follow it myself (except by > accident, as it were) but I've worked with neuro-atypical programmers > who found it really useful to have a common standard that they could > follow and reduce the

[Python-ideas] Re: Access (ordered) dict by index; insert slice

2020-06-26 Thread Steven D'Aprano
On Fri, Jun 26, 2020 at 10:45:07AM -0700, Brett Cannon wrote: > Why can't you do `tuple(dict.items())` to get your indexable pairs? I don't think that an immutable copy is going to help Hans with his use-case, since he already mentions that tuples don't solve his problem. Swapping to a list

[Python-ideas] Re: Amend PEP-8 to require clear, understandable comments instead of Strunk & White Standard English comments

2020-06-26 Thread Steven D'Aprano
On Fri, Jun 26, 2020 at 09:08:31PM -, Keara Berlin wrote: > Hi all, this is a very small change, but I thought I would field it > here to see if anyone has suggestions or ideas. Instead of requiring > that comments be written in Strunk & White Standard English, PEP-8 > should require

[Python-ideas] Re: Amend PEP-8 to require clear, understandable comments instead of Strunk & White Standard English comments

2020-06-26 Thread Keara Berlin
Good idea - I'll submit that now. ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at

[Python-ideas] Re: Amend PEP-8 to require clear, understandable comments instead of Strunk & White Standard English comments

2020-06-26 Thread David Mertz
Your minor change is certainly an improvement. _The Elements of Style_ ( https://en.wikipedia.org/wiki/The_Elements_of_Style) is certainly a good text, but it's not even actually a style guide in the formal sense. On Fri, Jun 26, 2020 at 5:26 PM Keara Berlin wrote: > Hi all, this is a very

[Python-ideas] Re: Amend PEP-8 to require clear, understandable comments instead of Strunk & White Standard English comments

2020-06-26 Thread Gregory P. Smith
Given I've never even heard of Strunk & White (my own privilege i'd assume)... yeah. I don't actually know what the existing "When writing English, follow Strunk and White." text in PEP-8 even means. It doesn't hyperlink to an online source for English style probably because this was written so

[Python-ideas] Amend PEP-8 to require clear, understandable comments instead of Strunk & White Standard English comments

2020-06-26 Thread Keara Berlin
Hi all, this is a very small change, but I thought I would field it here to see if anyone has suggestions or ideas. Instead of requiring that comments be written in Strunk & White Standard English, PEP-8 should require instead that English-language comments be clear and easily understandable by

[Python-ideas] Re: Access (ordered) dict by index; insert slice

2020-06-26 Thread Steele Farnsworth
It sounds like you're asking if the iteration order can be changed to be something other than the original insertion order, or if you can cause a new key-value pair to be added somewhere other than the end. I wonder if you can achieve the desired outcome without a change to the language. At any

[Python-ideas] Re: Access (ordered) dict by index; insert slice

2020-06-26 Thread Alex Hall
I think Hans would like to do `my_dict.items()[0]` for example, which shouldn't conflict with anything. On Fri, Jun 26, 2020 at 7:48 PM Brett Cannon wrote: > Why can't you do `tuple(dict.items())` to get your indexable pairs? > > Otherwise there are no plans as you would have to introduce a new

[Python-ideas] Re: Access (ordered) dict by index; insert slice

2020-06-26 Thread Joao S. O. Bueno
On Fri, 26 Jun 2020 at 14:30, Hans Ginzel wrote: > Date: Fri, 26 Jun 2020 18:47:44 +0200 > From: Hans Ginzel > To: Hans Ginzel > Subject: Access (ordered) dict by index; insert slice > > Hello, > > thank you for making dict ordered. > Is it planned to access key,value pair(s) by index? See >

[Python-ideas] Re: Access (ordered) dict by index; insert slice

2020-06-26 Thread Brett Cannon
Why can't you do `tuple(dict.items())` to get your indexable pairs? Otherwise there are no plans as you would have to introduce a new method as you can't assume e.g. `0` is being used as a dictionary key. On Fri, Jun 26, 2020 at 10:32 AM Hans Ginzel wrote: > Date: Fri, 26 Jun 2020 18:47:44

[Python-ideas] Access (ordered) dict by index; insert slice

2020-06-26 Thread Hans Ginzel
Date: Fri, 26 Jun 2020 18:47:44 +0200 From: Hans Ginzel To: Hans Ginzel Subject: Access (ordered) dict by index; insert slice Hello, thank you for making dict ordered. Is it planned to access key,value pair(s) by index? See https://stackoverflow.com/a/44687752/2556118 for example. Both for

[Python-ideas] Re: giving set.add a return value

2020-06-26 Thread Chris Angelico
On Fri, Jun 26, 2020 at 7:58 PM Steven D'Aprano wrote: > Most importantly, it matches the way people think about the task: > > # Task: look for duplicates > if element in seen: > # it's a duplicate > ... > else: > # never seen before, so remember it >

[Python-ideas] Re: giving set.add a return value

2020-06-26 Thread Dan Sommers
On Friday, June 26, 2020, at 04:54 -0500, Steven D'Aprano wrote: On Thu, Jun 25, 2020 at 05:27:16PM +0300, Ben Avrahami wrote: Hey all, Often I've found this kind of code: seen = set() for i in iterable: if i in seen: ... # do something in case of duplicates else: seen.add(i)

[Python-ideas] Re: giving set.add a return value

2020-06-26 Thread Steven D'Aprano
On Thu, Jun 25, 2020 at 05:27:16PM +0300, Ben Avrahami wrote: > Hey all, > Often I've found this kind of code: > > seen = set() > for i in iterable: > if i in seen: > ... # do something in case of duplicates > else: > seen.add(i) > ... # do something in case of first visit > >

[Python-ideas] Re: Allow signal suppression

2020-06-26 Thread Antoine Pitrou
On Thu, 25 Jun 2020 18:32:48 -0700 Yonatan Zunger via Python-ideas wrote: > > So that's an example of why you might find yourself in such a situation in > userland. And overall, Python's signal handling mechanism is pretty good; > it's *way* nicer than having to deal with it in C, since signal