[Python-ideas] objects aware of being bound to a name
ericsnowcurrently at gmail.com
Mon Jun 6 17:48:07 CEST 2011
On Sat, Jun 4, 2011 at 11:50 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> On Sun, Jun 5, 2011 at 11:54 AM, Terry Reedy <tjreedy at udel.edu> wrote:
>> Functions, classes, and modules have __name__ attributes (that cannot be
>> deleted, even if they can be replaced). This attribute is set before they
>> are optionally bound, so they also do not hear about the subsequent
>> bindings. This attribute is used for their string representations for humans
>> to read. I cannot think of any other use by the interpreter itself.
> __name__ attributes are also relevant for serialisation (esp. pickling).
> However, due to immutable objects, there's no realistic general
> purpose solution in this space.
Yeah, I think I was hasty on writing this up. It's interesting, but
not a great fit, nor very practical. The immutable objects problem is
definitely a show-stopper. Thanks for the feedback though.
> Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
> Python-ideas mailing list
> Python-ideas at python.org
More information about the Python-ideas