def test(self, func: t.Callable[..., bool], *args, **kwargs) -> Predicate:
"""
Run a user-defined test function against the value.
>>> def test_func(val):
... return val == 42
...
>>> var('f1').test(test_func)
:param func: The function
2qdxy4rzwzuui...@potatochowder.com writes:
> On 2021-02-18 at 18:10:16 +0400,
> Abdulla Al Kathiri wrote:
>
> > I will be very happy if those versions of Callable and anonymous
> > functions exist in Python right now. See how elegant that would look
> > like..
> >
> > def func(x: int,
On 19/02/21 9:43 am, Steven D'Aprano wrote:
Although I have heard from Ruby enthusiasts that the ability to write
large, complex, multi-statement anonymous block functions is really
useful, its not something I can personally say I have missed.
Ruby may be somewhat different here, because
On Thu, Feb 18, 2021 at 8:46 PM Steven D'Aprano wrote:
> Although I have heard from Ruby enthusiasts that the ability to write
> large, complex, multi-statement anonymous block functions is really
> useful, its not something I can personally say I have missed.
> I think that once you get past a
On Wed, Feb 17, 2021 at 07:03:55PM +, Gustavo Carneiro wrote:
> Just my 2c, I don't find lambda verbose at all, quite like it.
>
> But I wish Python allowed for multi-line lambda functions... somehow.
Python allows for multi-*line* lambda:
lambda key, value, condition, sep='',
On 2021-02-18 at 18:10:16 +0400,
Abdulla Al Kathiri wrote:
> I will be very happy if those versions of Callable and anonymous
> functions exist in Python right now. See how elegant that would look
> like..
>
> def func(x: int, y: int, f: (int, int) -> int) -> int:
> return f(x, y)
I will be very happy if those versions of Callable and anonymous functions
exist in Python right now. See how elegant that would look like..
def func(x: int, y: int, f: (int, int) -> int) -> int:
return f(x, y)
print(func(3, 4, (x, y) => x + y)) #Out: 7
Imagine your mouse is on
On Thu, Feb 18, 2021 at 9:57 PM Steven D'Aprano wrote:
>
> On Thu, Feb 18, 2021 at 06:21:19AM +1100, Chris Angelico wrote:
>
> > > I would personally love for SimpleNamespace to get a shorter name and
> > > become a built-in.
> > >
> >
> > Okay. Let's start bikeshedding. If SimpleNamespace were
On 18.02.2021 12:00, Steven D'Aprano wrote:
> On Wed, Feb 17, 2021 at 11:28:05AM -0800, Brendan Barnwell wrote:
>
>> When I see people suggest
>> SimpleNamespace, it's usually just to use it as a dict which is accessed
>> with attribute syntax instead of item syntax.
>
> If its a dict, it must
On Wed, Feb 17, 2021 at 11:28:05AM -0800, Brendan Barnwell wrote:
> When I see people suggest
> SimpleNamespace, it's usually just to use it as a dict which is accessed
> with attribute syntax instead of item syntax.
If its a dict, it must have dict methods. That leads to conflict: data
On Thu, Feb 18, 2021 at 06:21:19AM +1100, Chris Angelico wrote:
> > I would personally love for SimpleNamespace to get a shorter name and
> > become a built-in.
> >
>
> Okay. Let's start bikeshedding. If SimpleNamespace were to become a
> builtin, what should its name be?
The traditional name
Hello,
On Thu, 18 Feb 2021 21:27:18 +1100
Steven D'Aprano wrote:
[]
> Or we could just use a one-liner:
>
> >>> from types import SimpleNamespace
>
> and get all of that for free. And if it were a builtin, it would be a
> zero-liner.
Right. If the whole CPython stdlib were builtin,
On Thu, Feb 18, 2021 at 11:50:17AM +1300, Greg Ewing wrote:
> It's dead simple to define
> your own blank-object class, and you get to give it a name that
> reflects what you're really doing with it. I don't understand
> why there's such a fascination with things like SimpleNamespace.
Right, it
Hello,
On Wed, 17 Feb 2021 18:43:09 -0300
"Joao S. O. Bueno" wrote:
> On Wed, 17 Feb 2021 at 18:15, Abdulla Al Kathiri <
> alkathiri.abdu...@gmail.com> wrote:
>
> > How is this not pythonic?
> >
> > series.apply(x -> x**2)
> > Compared to..
> > series.apply(lambda x: x**2)
> >
> >
> > (x, y)
14 matches
Mail list logo