On Mon, Oct 4, 2021 at 5:46 PM Erik Demaine wrote:
> Have folks thought about allowing indexing dictionary views as in the
> following code, where d is a dict object?
>
> d.keys()[0]
> d.keys()[-1]
> d.values()[0]
> d.values()[-1]
> d.items()[0]
> d.items()[-1] # item that would be returned by
On Tue, Oct 5, 2021 at 9:46 AM Erik Demaine wrote:
> Of course, the universal way to get the
> first item from an iterable x is
>
> item = next(iter(x))
>
> I can't say this is particularly readable, but it is functional and fast.
I think we can add `itertools.first()` for this idiom, and
Have folks thought about allowing indexing dictionary views as in the
following code, where d is a dict object?
d.keys()[0]
d.keys()[-1]
d.values()[0]
d.values()[-1]
d.items()[0]
d.items()[-1] # item that would be returned by d.popitem()
I could see value to the last form in particular: you
On Tue, Oct 5, 2021 at 9:50 AM Caleb Donovick wrote:
>
> > 2) Some OTHER exception occurs on the reevaluation. It's a chained
> > exception like any other.
>
> Except it's not a chained exception and displaying as such would be VERY
> confusing IMO.
> Granted we could easily strip the chained
> 2) Some OTHER exception occurs on the reevaluation. It's a chained
> exception like any other.
Except it's not a chained exception and displaying as such would be VERY
confusing IMO.
Granted we could easily strip the chained exception and just return the
original one. So after
reconsideration
> I wonder, could this be simplified a bit, on the assumption that a
> well-written assertion shouldn't have a problem with being executed
> twice?
While I agree as an engineering principle an assert should not have side
effects
and hence re-evaluation should be fine in most cases, it is not
On Tue, Oct 5, 2021 at 9:02 AM Caleb Donovick wrote:
>
> > I wonder, could this be simplified a bit, on the assumption that a
> > well-written assertion shouldn't have a problem with being executed
> > twice?
>
> While I agree as an engineering principle an assert should not have side
> effects
Le dim. 3 oct. 2021 à 16:21, a écrit :
> Date: Mon, 4 Oct 2021 01:03:34 +1100
> From: Steven D'Aprano
> Subject: [Python-ideas] Re: Feature request enumerate_with_rest or
> enumerate with skip or filter callback
> To: python-ideas@python.org
> Message-ID:
Le dim. 3 oct. 2021 à 16:21, a écrit :
> Date: Mon, 4 Oct 2021 01:03:34 +1100
> From: Steven D'Aprano
> Subject: [Python-ideas] Re: Feature request enumerate_with_rest or
> enumerate with skip or filter callback
> To: python-ideas@python.org
> Message-ID:
Greetings list,
Just a funny Reddit quote:
(.NET 5 minimal APIs are even easier, and I swear .NET starts
to feel more like Python to me all the time, especially since
they removed the need for a Main method).
Abdulla Al Kathiri wrote:
> Oh I forgot what if you want to return a set from your lambda? Maybe a lambda
> set should at least have one assignment statement to qualify it as one.
> Expressions only inside a set syntax will be just a normal set that doesn’t
> care about order as you pointed
11 matches
Mail list logo