On Tue, Feb 19, 2019 at 7:04 AM Avi Gross <avigr...@verizon.net> wrote:
> How about functions?
>
> Even more confusing:
>
> >>> def a(): pass
>
> >>> def b(): pass
>
> >>> id(a), id(b)
> (13123280, 13201816)
> >>> b=a
> >>> id(a), id(b)
> (13123280, 13123280)
> >>> def a(): return True
>
> >>> id(a), id(b)
> (13201816, 13123280)
>
> The above shows that making two independent (albeit otherwise minimally
> identical) functions makes two different id and copying one to the other
> makes them the same but then changing one gets back the same ID reused!

Actually, this part isn't explained by the id() docs. To understand
this, you need to go back to something even more basic: the meaning of
assignment. You did not copy one to the other. You simply changed name
bindings. Here. Read.

https://nedbatchelder.com/text/names1.html

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to