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 ha
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
>
> Th
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)
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
> ..
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 re
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 +020
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
> ht
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
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 ti
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
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 l
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 smal
Good idea - I'll submit that now.
___
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.pyth
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 instea
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 giv
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 uncerta
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 overall,
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 <
[email protected]> wrote:
> On Fri, Jun 26, 2020 at 9:43 PM Steven D'Aprano
> wrote:
>
>> I dislike
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 mo
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
su
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 doesn'
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.
> >
>
> S
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:
> >
> > > "
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 *add
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 confusing
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
senten
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&W here on this mailing list, and I've expl
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
remov
On 27/06/20 4:25 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".
The fact that you haven't noticed until now suggests that
you've never written any code that depends on the
On 27/06/20 4:33 pm, Steven D'Aprano wrote:
Take the word out of the sentence, and does the sentence still mean the
same thing? Then the word was needless. That's an objective test.
But in something a fuzzy as natural language, "the same thing"
is not a boolean value. How close in meaning does
On 27/06/20 5:30 pm, David Mertz wrote:
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.
Also, does it actually say anything that would forbid or discourage
use of terms such as "chocker" and "chu
On Fri, Jun 26, 2020 at 10:10:22PM +1000, Chris Angelico wrote:
> 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
> >
32 matches
Mail list logo