[Python-ideas] Re: List .index() Method

2021-01-31 Thread Evpok Padding
On Fri, 29 Jan 2021 at 14:37, Francis O'Hara Aidoo wrote: > I understand that the same effect can be achieved with the index notation > - as in > if listy[-1] == 10: > print("Monty Python") > - but the way that came naturally to me was to use the .index method > rather than index notation, an

[Python-ideas] Re: PEP 671: Syntax for late-bound function argument defaults

2021-11-01 Thread Evpok Padding
I definitely agree with that sentiment, with beginners I don't even talk about function defaults at first, and when I do, it's when we have already have a talk about mutables so I can just say that you almost never want a mutable default but rather use None as a sentinel. It's not that hard and it

[Python-ideas] Re: Enhancing iterator objects with map, filter, reduce methods

2021-11-26 Thread Evpok Padding
> . In fact, I'd be > pretty certain that something like this probably already exists on > PyPI, but I wouldn't know how to find it. It's supported with several syntaxes in macropy ( https://pypi.org/project/MacroPy/) but I remember seeing it in a more serious (for lack of a better term) package t

[Python-ideas] Re: Enhancing iterator objects with map, filter, reduce methods

2021-11-26 Thread Evpok Padding
Ah yes, it's pipeop ! https://pypi.org/project/pipeop/ On Fri, 26 Nov 2021 at 22:39, Evpok Padding wrote: > > . In fact, I'd be > > pretty certain that something like this probably already exists on > > PyPI, but I wouldn't know how to find it. > >

[Python-ideas] Re: Enhancing iterator objects with map, filter, reduce methods

2021-11-28 Thread Evpok Padding
Hi, All apologies if it has been clarified earlier, but if you dislike nested method calls what is wrong with operating on generators as in ```pycon >>> itr = (i**2 for i in range(8)) >>> itr = (i-1 for i in itr if i > 0) >>> list(itr) [0, 3, 8, 15, 24, 35, 48] ``` This covers chains of maps and

[Python-ideas] Re: Applications user/system directories functions

2021-12-15 Thread Evpok Padding
Hi, [xdg](https://pypi.org/project/xdg).xdg_config_home seems to give you the parent of what you need, doesn't it? Cheers, E On Wed, 15 Dec 2021 at 13:47, JGoutin via Python-ideas < [email protected]> wrote: > Hello, > > The idea is to add 3 functions to get "config", "data" and "cache"

[Python-ideas] Re: PEP 9999: Retire animal-unfriendly language

2020-03-31 Thread Evpok Padding
Even if you think this is clever or funny, are you absolutely sure you needed to share it with the subscribers to this mailing list? On Tue, 31 Mar 2020 at 17:46, Andrew Barnert via Python-ideas < [email protected]> wrote: > Dear Sir, I wish to complain in the strongest possible terms about

[Python-ideas] Re: An itertools.interleave / itertools.join function

2020-12-09 Thread Evpok Padding
Hey, You can always do `itertools.chain.from_iterable(zip(iterable, itertools.repeat(sep)))` but I agree that it is verbose. Cheers, E On Wed, 9 Dec 2020 at 04:16, wrote: > Hi > > I like using itertools for creating long strings while not paying the cost > of intermediate strings (by eventual

Re: [Python-ideas] Temporary variables in comprehensions

2018-02-15 Thread Evpok Padding
For simple cases such as `[y + g(y) for y in [f(x) for x in range(10)]]`, I don't really see what the issue is, if you really want to make it shorter, you can ``[y + g(y) for y in map(f,range(10))]` which is one of the rare case where I like `map` more than comprehensions. For more complex case, j

Re: [Python-ideas] PEP 572: Assignment Expressions (post #4)

2018-04-12 Thread Evpok Padding
On 11 April 2018 at 23:09, Brendan Barnwell wrote: > On 2018-04-11 11:05, David Mertz wrote: > >> How about this, Brendan? >> >> _, x1, x2 = (D := b**2 - 4*a*c), (-b + sqrt(D))/2, (-b - sqrt(D))/2 >> >> I'm not sure I love this, but I don't hate it. >> > > That's clever, but why bother?