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 <j...@yourlabs.org> 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] > 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 for defaults: > https://mail.python.org/pipermail/python-list/2021-February/900795.html > > -- > ∞ > -- ∞ On Thu, Feb 11, 2021 at 12:48 PM Paul Sokolovsky <pmis...@gmail.com> wrote: > Hello, > > On Thu, 11 Feb 2021 12:24:55 +0100 > "J. Pic" <j...@yourlabs.org> 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 mapping to a list, where do you see lambda here? > > Generally, if you have an idea like that, please go ahead and implement > it with one of the existing macro engines for Python. That alone should > give yourself more insight how viable it is. Here's tutorial to get you > started: https://github.com/aroberge/ideas#usage > > > > -- > Best regards, > Paul mailto:pmis...@gmail.com > -- ∞
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/2AKUU5VSBIN5D76EJBJG3RSDICNEZKFF/ Code of Conduct: http://python.org/psf/codeofconduct/