On 01.06.2016 17:19, Steven D'Aprano wrote:
On Wed, Jun 01, 2016 at 11:10:19AM +1200, Greg Ewing wrote:
Steven D'Aprano wrote:
name -> Function(args)
will be expanded to:
name = Function('name', args) Another possibility would be to expand it to
name = Function(args) name.__name__ = "name" That priviledges one specific use of the name over all others. You'll note that I was very careful to describe the use-case as "objects that need to know their own name" but didn't specify what they did with the name. Maybe they bind it to self.__name__, but maybe they use self.name instead. Or they write it to a database. Who knows?
I don't think we should specify what the object does with the name.
A dunder method could help here. So, the object can decide what to do with it. Best, Sven