Hello,
On Fri, 12 Feb 2021 18:26:53 +1100
Chris Angelico wrote:
> On Fri, Feb 12, 2021 at 6:24 PM Paul Sokolovsky
> wrote:
> > ... And on the 2nd thought, that won't work. The reason it works in
> > JS is that it doesn't have tuples. In Python, "(a, b) => (1, 2)"
> > means "compare a tuple for
On Fri, Feb 12, 2021, at 02:23, Paul Sokolovsky wrote:
> > Great to hear there's no desire to stray away from JavaScript just for
> > the purpose of being different.
>
> ... And on the 2nd thought, that won't work. The reason it works in JS
> is that it doesn't have tuples. In Python, "(a, b) =>
On Fri, Feb 12, 2021 at 6:24 PM Paul Sokolovsky wrote:
> ... And on the 2nd thought, that won't work. The reason it works in JS
> is that it doesn't have tuples. In Python, "(a, b) => (1, 2)" means
> "compare a tuple for greater-or-equal".
Should be safe actually - "=>" is not a valid comparison
Hello,
On Fri, 12 Feb 2021 09:55:16 +0300
Paul Sokolovsky wrote:
> Hello,
>
> On Thu, 11 Feb 2021 21:36:25 -0800
> Guido van Rossum wrote:
>
> > > but I think it'd probably be
> > > better to use similar syntax to C#, Java, and Javascript instead,
> > > and use () -> [12] or () => 12...
> >
Hello,
On Thu, 11 Feb 2021 21:36:25 -0800
Guido van Rossum wrote:
> > but I think it'd probably be
> > better to use similar syntax to C#, Java, and Javascript instead,
> > and use () -> [12] or () => 12...
> >
>
> Agreed. I'd prefer the JavaScript solution, since -> already has a
>
Hello,
On Thu, 11 Feb 2021 23:57:16 -0500
Random832 wrote:
[]
> > > I'd like to propose the following:
> > >
> > > w = (): [12]
> >
> > What will be the meaning of {(): [12]} ? Hint: it will be a
> > dictionary of empty tuple mapping to a list, where do you see
> > lambda here?
>
> This
On Thu, Feb 11, 2021 at 8:58 PM Random832 wrote:
> On Thu, Feb 11, 2021, at 06:48, Paul Sokolovsky wrote:
> > Hello,
> >
> > On Thu, 11 Feb 2021 12:24:55 +0100
> > "J. Pic" wrote:
> >
> > > Hi all,
> > >
> > > Lambdas can be defined as such:
> > >
> > > w = lambda: [12]
> > > x = lambda y:
On Thu, Feb 11, 2021, at 06:48, Paul Sokolovsky wrote:
> Hello,
>
> On Thu, 11 Feb 2021 12:24:55 +0100
> "J. Pic" wrote:
>
> > Hi all,
> >
> > Lambdas can be defined as such:
> >
> > w = lambda: [12]
> > x = lambda y: len(y)
> >
> > I'd like to propose the following:
> >
> > w = (): [12]
>
On Thu, 11 Feb 2021 at 15:09, J. Pic wrote:
>
> I think you also need return, and double space pound space qa to pass linters:
>
> def foo(): return 1 # noqa
>
> Instead of
>
> foo = lambda: 1
>
> And this proposal:
>
> foo(): 1
>
> The benefit is just to get more out of the 80 characters when we
Hello,
On Fri, 12 Feb 2021 01:37:35 +1100
Steven D'Aprano wrote:
> I think it is probably pointless now, but you might get
> more response if you post actual examples of the syntax and
> semantics, explaining how your proposal differs from the (now
> accepted) alternative, and why you
On Fri, Feb 12, 2021 at 1:01 AM Henry Harutyunyan
wrote:
> this is fine as long as you need to use that filter for once. But if you want
> to reuse it you either need to create the iterator every time specifying the
> filter function, or save the function in a var and create the filter with
>
I think you also need return, and double space pound space qa to pass
linters:
def foo(): return 1 # noqa
Instead of
foo = lambda: 1
And this proposal:
foo(): 1
The benefit is just to get more out of the 80 characters when we want to
define a short callback.
I understand this is not a life
On Thu, Feb 11, 2021 at 12:42:39PM +0100, J. Pic wrote:
> foo(x): len(x)
>
> Would be equivalent to:
>
> foo = lambda x: len(x)
>
> Would that work?
The question is not whether it would work, but whether it would be a
good idea. What benefit does it give?
Just write:
def foo(x): return
I think it is probably pointless now, but you might get more response if
you post actual examples of the syntax and semantics, explaining how
your proposal differs from the (now accepted) alternative, and why you
made the choices you did.
You should also consider that pattern matching is built
On 2/11/21, M.-A. Lemburg wrote:
> On 11.02.2021 13:49, Eryk Sun wrote:
>
>> Currently, locale.getpreferredencoding(False) is implemented as
>> locale._get_locale_encoding(). This ultimately calls
>> _Py_GetLocaleEncoding(), defined in "Python/fileutils.c".
>> TextIOWrapper() calls this C
I think one function returning multiple types must be confusing.
You should use `functools.partial` or create new function with def or lambda.
>> from functools import partial
>>
>> pass_filter = partial(filter, lambda x: x > 60)
>> foo = [42, 56, 67, 87]
>> for i in pass_filter(foo):
>>
One of my students gave me an interesting question about why `filter` and `map`
do not return a reusable function in case the iterable is not passed.
With the current design
```
In [1]: a = filter(lambda x: x > 60)
---
On 11.02.2021 13:49, Eryk Sun wrote:
> On 2/11/21, M.-A. Lemburg wrote:
>
>> I think the main problem here is that open() doesn't use
>> locale.getlocale()[1] as default for the encoding parameter,
>> but instead locale.getpreferredencoding(False).
>
> Currently,
On 2/11/21, M.-A. Lemburg wrote:
> I think the main problem here is that open() doesn't use
> locale.getlocale()[1] as default for the encoding parameter,
> but instead locale.getpreferredencoding(False).
Currently, locale.getpreferredencoding(False) is implemented as
Oh, I didn't think of it, thank you Paul.
Inspiration from JavaScript was not a good idea. Instead, would like to
propose to make the "def" keyword optional like in bash:
foo(x): len(x)
Would be equivalent to:
foo = lambda x: len(x)
Would that work?
On Thu, Feb 11, 2021 at 12:24 PM J. Pic
Hello,
On Thu, 11 Feb 2021 12:24:55 +0100
"J. Pic" wrote:
> Hi all,
>
> Lambdas can be defined as such:
>
> w = lambda: [12]
> x = lambda y: len(y)
>
> I'd like to propose the following:
>
> w = (): [12]
What will be the meaning of {(): [12]} ? Hint: it will be a dictionary
of empty tuple
Hi all,
Lambdas can be defined as such:
w = lambda: [12]
x = lambda y: len(y)
I'd like to propose the following:
w = (): [12]
x = (y): len(y)
Or even another contraction for when there are no arguments:
w =: [12]
This would also be consistent with the other proposal on anonymous
functions
On 10.02.2021 23:10, Eryk Sun wrote:
> On 2/10/21, M.-A. Lemburg wrote:
>>
>> setx PYTHONUTF8 1
>>
>> does the trick in an admin command shell on Windows globally.
>
> The above command sets the variable only for the current user, which
> I'd recommend anyway. It does not require administrator
I looked some Python courses for children. They won't use venvs.
For example, they put .py file in a specified directory, then run it
in the Minecraft or other graphical applications.
Now I think we should promote putting PYTHONUTF8=1 in user environment
before thinking about complex per-site
24 matches
Mail list logo