[Python-ideas] Repr of lambda

Steve Barnes gadgetsteve at live.co.uk
Mon Dec 18 08:31:22 EST 2017

On 18/12/2017 11:43, Steven D'Aprano wrote:
> On Mon, Dec 18, 2017 at 07:54:17AM +0000, 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: yes it is. What's your point? That's not
> a rhetorical question -- I genuinely don't understand why you raise
> this. Do you see the existence of inspect.* as negating the usefulness
> of giving functions a more useful repr? As proof that the information is
> available? Something else?

Hi Steve,

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) which is bound to break something somewhere. Now if you were 
to suggest adding a verbose flag to repr or a print format, maybe both - 
so that people don't have to import inspect then I would say that you 
have a lot less chance of breaking any code/test cases that is in the wild.

Sorry I should have made my point(s) clearer.

Steve (Gadget) Barnes
Any opinions in this message are my personal opinions and do not reflect 
those of my employer.

This email has been checked for viruses by AVG.

More information about the Python-ideas mailing list