Re: [Python-ideas] Repr of lambda

2017-12-23 Thread Nick Coghlan
On 22 Dec. 2017 12:32 pm, "Chris Angelico" wrote: On Fri, Dec 22, 2017 at 9:43 AM, Chris Barker wrote: > Every python object has an object identity, and the way to get it is with > the id() function. The id is also part of the default object repr, but

Re: [Python-ideas] Repr of lambda

2017-12-21 Thread Chris Angelico
On Fri, Dec 22, 2017 at 9:43 AM, Chris Barker wrote: > Every python object has an object identity, and the way to get it is with > the id() function. The id is also part of the default object repr, but given > that some, but only some objects have the id in their repr, it's

Re: [Python-ideas] Repr of lambda

2017-12-21 Thread Chris Barker
On Thu, Dec 21, 2017 at 12:34 PM, Barry wrote: > > On 21 Dec 2017, at 06:57, Chris Barker wrote: > > > > in theory, the "goal" is for eval(repr(obj)) to return an equivalent > object > > Is that really was the goal of repr? I think so -- see the

Re: [Python-ideas] Repr of lambda

2017-12-21 Thread Eric Fahlgren
Could we call it "help"? Maybe add some beef to what's already there... >>> help(lambda x,y,*args: x) Help on function in module __main__: lambda x, y, *args On Thu, Dec 21, 2017 at 12:34 PM, Barry wrote: > > > > On 21 Dec 2017, at 06:57, Chris Barker

Re: [Python-ideas] Repr of lambda

2017-12-21 Thread Barry
> On 21 Dec 2017, at 06:57, Chris Barker wrote: > > in theory, the "goal" is for eval(repr(obj)) to return an equivelent object Is that really was the goal of repr? If true then we would not need pickle. I have always assumed that repr of simple things aims to

Re: [Python-ideas] Repr of lambda

2017-12-20 Thread Chris Barker
On Mon, Dec 18, 2017 at 5:31 AM, Steve Barnes wrote: > I see it as showing that the information is already available to anybody > who needs it so I question the usefulness of changing repr (for > everybody) > @dataclass > class C: > a: "the a parameter" # field with

Re: [Python-ideas] Repr of lambda

2017-12-20 Thread Brett Cannon
I'm in the middle of moving, so I'm not planning to take this any farther than this email unless someone explicitly brings up an issue by emailing Python-ideas-owner where Titus can help anyone out. On Wed, Dec 20, 2017, 16:11 Steven D'Aprano, wrote: > On Wed, Dec 20, 2017

Re: [Python-ideas] Repr of lambda

2017-12-20 Thread Steven D'Aprano
On Wed, Dec 20, 2017 at 03:55:01PM -0500, Franklin? Lee wrote: > Wow, that's way too aggressive for this list. Hair-trigger sensitivity to "aggressiveness" is itself a form of aggression, because it leads to unfair accusations of aggressiveness and other over-reactions, and forces people to

Re: [Python-ideas] Repr of lambda

2017-12-20 Thread Franklin? Lee
On Mon, Dec 18, 2017 at 8:31 AM, Steve Barnes wrote: > > On 18/12/2017 11:43, Steven D'Aprano wrote: >> On Mon, Dec 18, 2017 at 07:54:17AM +, Steve Barnes wrote: >> >>> Isn't this exactly the sort of information already available via >>> inspect.getardspec,

Re: [Python-ideas] Repr of lambda

2017-12-18 Thread Steve Barnes
On 18/12/2017 11:43, Steven D'Aprano wrote: > On Mon, Dec 18, 2017 at 07:54:17AM +, Steve Barnes wrote: > >> Isn't this exactly the sort of information already available via >> inspect.getardspec, inspect.getsourcelines & inspect.getsource? > > [snip ipython interactive session showing

Re: [Python-ideas] Repr of lambda

2017-12-18 Thread Ivan Levkivskyi
Serhiy, I like the idea, but in typeshed we have an agreement to always show a default value by an ellipsis. For example, definition like this: def fun(x, y, z=0): return x + y + z can be represented like this fun(x, y, z=...) or if one has annotations in the definition, then fun(x: int,

Re: [Python-ideas] Repr of lambda

2017-12-18 Thread Steven D'Aprano
On Mon, Dec 18, 2017 at 07:54:17AM +, Steve Barnes wrote: > Isn't this exactly the sort of information already available via > inspect.getardspec, inspect.getsourcelines & inspect.getsource? [snip ipython interactive session showing that the answer is "Yes"] You answered your own question:

Re: [Python-ideas] Repr of lambda

2017-12-18 Thread Steve Barnes
On 18/12/2017 06:11, Ivan Pozdeev via Python-ideas wrote: > On 17.12.2017 22:20, Serhiy Storchaka wrote: >> Currently repr of doesn't contain much of information besides that it >> is a lambda. >> >> >>> lambda x: x**2 >> at 0x7f3479b74488> >> >> All lambdas have the same repr, different only

Re: [Python-ideas] Repr of lambda

2017-12-18 Thread Serhiy Storchaka
17.12.17 22:55, Terry Reedy пише: What if include the signature and the expression of the lambda in its repr?  >>> lambda x: x**2 Printing the return value requires adding a code or function attribute. Yes, this requires adding an optional constant code attribute. The return

Re: [Python-ideas] Repr of lambda

2017-12-17 Thread Ivan Pozdeev via Python-ideas
On 17.12.2017 22:20, Serhiy Storchaka wrote: Currently repr of doesn't contain much of information besides that it is a lambda. >>> lambda x: x**2 at 0x7f3479b74488> All lambdas have the same repr, different only by unreadable hexadecimal address. What if include the signature and the

Re: [Python-ideas] Repr of lambda

2017-12-17 Thread Terry Reedy
On 12/17/2017 2:20 PM, Serhiy Storchaka wrote: Currently repr of doesn't contain much of information besides that it is a lambda. >>> lambda x: x**2 at 0x7f3479b74488> All lambdas have the same repr, different only by unreadable hexadecimal address. Having the same pseudo-name is what

[Python-ideas] Repr of lambda

2017-12-17 Thread Serhiy Storchaka
Currently repr of doesn't contain much of information besides that it is a lambda. >>> lambda x: x**2 at 0x7f3479b74488> All lambdas have the same repr, different only by unreadable hexadecimal address. What if include the signature and the expression of the lambda in its repr? >>> lambda