On Sat, May 23, 2020, 12:26 AM Steven D'Aprano
> Obviously not all such key functions are that simple and you may need to
> write a helper function, but the same applies to filter.
>
I like the key function much better than the predicate. In large part
that's because as soon as you say
On Fri, May 22, 2020 at 06:37:11PM -0700, Ethan Furman wrote:
> On 05/22/2020 05:11 PM, David Mertz wrote:
> >On 05/22/2020 04:43 AM, Steven D'Aprano wrote:
>
> >>i = somelist.index(needle, pred=comparison)
>
> >Why not just this (by object, not by its index, but that seems simpler):
> >
> >
On Fri, May 22, 2020 at 8:59 PM Steven D'Aprano wrote:
> > Why not just this (by object, not by its index, but that seems simpler):
> > >>> do_something(next(filter(pred, somelist)))
>
> Sure, that works too. But have you ever written it for real? I haven't.
> And having seen it, I'll probably
On 05/22/2020 05:11 PM, David Mertz wrote:
On 05/22/2020 04:43 AM, Steven D'Aprano wrote:
i = somelist.index(needle, pred=comparison)
Why not just this (by object, not by its index, but that seems simpler):
>>> do_something(next(filter(pred, somelist)))
Something about 55
>>>
On Fri, May 22, 2020 at 08:11:16PM -0400, David Mertz wrote:
> >
> > After I answered that question, it dawned on me that I have probably
> > written something like that loop, or variations of it, a thousand times:
> >
> > for obj in somelist:
> > if comparison(obj, needle):
> >
On Thu, May 21, 2020 at 02:50:00PM +0200, Alex Hall wrote:
> On Thu, May 21, 2020 at 12:27 AM James Lu wrote:
>
> > > This is already valid in 3.8, so we should forget about overloading :=
> > > with a second meaning.
> >
> > def func(x=(a:=expression), y=a+1):
> > def func(x:=options):
> >
> >
>
> After I answered that question, it dawned on me that I have probably
>
written something like that loop, or variations of it, a thousand times:
>
> for obj in somelist:
> if comparison(obj, needle):
> do_something(obj)
> break
>
Why not just this (by
Have a look at this short thread on discuss:
https://discuss.python.org/t/searching-array-of-data-objects/4251/1
After I answered that question, it dawned on me that I have probably
written something like that loop, or variations of it, a thousand times:
for obj in somelist:
if
Hello,
On Fri, 22 May 2020 21:01:03 +0100
Andrey Cizov wrote:
> Sorry I forgot to add the URL:
> https://pypi.org/project/tagged-dataclasses/
How does this compare with many other implementations spread over the
interwebs?
As a quick comment, looks verbose comparing to ML ;-).
For
Sorry I forgot to add the URL:
https://pypi.org/project/tagged-dataclasses/
On Fri, 22 May 2020 at 20:25, Andrey Cizov wrote:
> I have developed a library to introduce tagged unions to python that uses
> dataclasses to define disjoint members of the tagged union (by defining
> them as Optional
On Thu, May 21, 2020 at 06:48:55PM +0300, Serhiy Storchaka wrote:
> 21.05.20 16:45, Alex Hall пише:
> >≥ instead of >= might be an improvement because that's a
> >symbol learned in school, but ultimately the student still needs to
> >learn what `>=` means as it will be used most of the time.
>
On Thu, May 21, 2020 at 2:50 PM Alex Hall wrote:
> Personally I think the best way forward on this would be to accept PEP
> 505. It wouldn't solve this particular problem in the most concise way but
> it would be pretty good and would be more broadly useful.
>
Having thought about this problem
I have developed a library to introduce tagged unions to python that uses
dataclasses to define disjoint members of the tagged union (by defining
them as Optional fields). With some additional validation I make sure that
only one of the fields is not None.
I find that it also fits well with the
On 21/05/2020 14:50, Steve Barnes wrote:
The issue is simple and simple enough for a beginner to fall foul of - test
procedure:
Change directory to any directory with files in totally a few 10s of megs
(ideally but it doesn't matter much).
python -m zipfile -c my_zipfile.zip .
Wait a few
On 22/05/2020 18:21, Mike Miller wrote:
More importantly, does it help readability? I think it does, however
not strongly. I'm perhaps +0.5 on a few of these characters. Word
processors do upgrades to hyphens, for example, to make the resulting
doc more readable. Is that kind of thing
On 2020-05-22 05:57, Joao S. O. Bueno wrote:
render . However, that does not mean it will render ok
as a single-cell character in a mono-spaced font - as the
character "east asian width" property is marked as "A" (Ambiguous),
Yes, though I'm sure no one is seriously proposing using wide, or
On Fri, May 22, 2020 at 11:21 AM David Mertz wrote:
> The main point of this, is that the code is still just plain ASCII, it
> just happens to look "fancier." It requires no plugins, and it does not
> require a JetBrains IDE or editor. I haven't tried every editor, but I
> believe that most
As is... my editor looks like this. I don't type all those special things,
except once in a configuration file. But the "prettification" is handled
transparently when I type some ASCII sequences.
[image: Python-arrow.png]
> that’s nice ! it’s a real shame though, and a bit of a waste
On Fri, May 22, 2020 at 11:02 PM Joao S. O. Bueno wrote:
> I am recording a video series trying to present Python programing to
> absolute beginners - and to keep things timely, the ambiguity between
> two valid quote types is already a _pain_ - which I simply try to avoid
> by making consistent
On Friday, May 22, 2020, at 8:28, Steven D'Aprano wrote:
> On Thu, May 21, 2020 at 09:43:33AM -0400, Dan Sommers wrote:
>
>> I had a customer who was old enough to
>> use upper case letter O for zero and lower case letter l for 1 because
>> she was old enough to have learned to type before
On Thu, 21 May 2020 at 18:15, Mike Miller wrote:
>
>
> On 2020-05-21 05:48, Joao S. O. Bueno wrote:
> > Input _is_ hard or rare. Deal with it.
> > Even the font is not uniformily configured across systems, and a glyph one
> > does see here may not show properly on the terminal, or other
>
>
>
On 22/05/2020 02:10, Tiago Illipronti Girardi wrote:
Is `?=` an operator? One could define `a ?= b` as `if a is None: a = b`
(which is similar to make's operator, for example).
PEP 505 (https://www.python.org/dev/peps/pep-0505/) prefers "??=".
That's a discussion that comes back now and
On Thu, May 21, 2020 at 09:43:33AM -0400, Dan Sommers wrote:
> I had a customer who was old enough to
> use upper case letter O for zero and lower case letter l for 1 because
> she was old enough to have learned to type before typewriters had number
> keys; that made a real mess of sorting street
Is `?=` an operator? One could define `a ?= b` as `if a is None: a = b`
(which is similar to make's operator, for example). Compare:
def func(arg, option=None):
option ?= expr
#impl
instead of:
def func(arg, option=None):
if option is None:
option =
On Fri, May 22, 2020 at 08:09:29AM +, Steve Barnes wrote:
> Unfortunately we have no control over where the tests may be run – if
> run on Windows from the C: drive it could potentially brick the entire
> machine, (which of course some people might consider a bonus of
> course).
I'm
>
> I believe I speak for a significant majority of professional programmers
> when I say that eye-candy like this adds no value to the language for me.
> It gives me no new capabilities, I don't see it making me more productive,
> and we have syntax that works quite well already.
>
This speaks
From: Guido van Rossum
Sent: 21 May 2020 16:59
To: Steve Barnes
Cc: remi.lape...@henki.fr; python-ideas@python.org
Subject: Re: [Python-ideas] Re: How to propose a change with tests where the
failing test case (current behaviour) is bad or dangerous
Hi Steve,
Have you considered and
27 matches
Mail list logo