Re:Stop writing lambda expressions in Python
by nikofeyn on Thursday September 27, 2018 @04:17PM
(#18088165)
i am not for sure what you mean by "original name". the value of each of those function definitions are:
you call them the same way, and they have the same type. a caller has no knowledge of how they were defined because it isn't important. they're identical.
[ Parent
| on HN ]
Re:Stop writing lambda expressions in Python
by jjnoakes on Thursday September 27, 2018 @05:09PM
(#18088705)
I mean in python, one can ask a function what it was originally defined as. Sounds like in F# one can not, so that's why there's a difference in python between "var x = lambda..." and "def y(): ..."; the latter knows it is named "y" and the former has no idea what its name is (so it is "lambda").
Re:Stop writing lambda expressions in Python
by yorwba on Thursday September 27, 2018 @04:35PM
(#18088357)
> they're identical.
Does that mean that test1 == test2 will return true?
Personally, I have found it very useful for debugging that function objects in Python carry their name. That makes it much easier to find out where something is coming from.