Why an object changes its "address" between adjacent calls?

Jach Fong jfong at ms4.hinet.net
Tue Jun 19 21:19:10 EDT 2018


Terry Reedy at 2018/6/19 PM 08:35 wrote:
> On 6/18/2018 8:38 PM, sales at caprilion.com.tw wrote:
>> Grant Edwards at 2018/6/18 PM 10:36 wrote:
>>> On 2018-06-17, Jach Fong <jfong at ms4.hinet.net> wrote:
>>>> The "address" of the Font object 'TkDefaultFont' changes, why?
>>>
>>> What makes you think it's the same object the second time and not a
>>> new object?
>>
>> Simply from what the method's name "name-to-font" implied. The font is 
>> already there, so naturally it should be the same one:-)
> 
> 'nametofont' is a trivial function returning 'Font(name=name, 
> exists=True)'.  As explained before, the address is the address of the 
> Python Font interface object, not the tk font structure.  tk has a 
> mapping of font names to font structures.  tkinter does not keep a dict 
> mapping names or font structures to Font instances, so each call to Font 
> returns a new Font instance.
> 
Thank you, Terry. I understand the relationship between Python-
tkinter-tk after you had explained before. Even though, I had to push
myself back to the status when I started this thread, to reply
Grant's question:-)

After switching from comp.lang.python to python-list a while, I noticed
that a thread can become fragile caused by the delay of email. Sometimes
it makes discussion a little confusion:-)

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus




More information about the Python-list mailing list