Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Intricacies of Aliasing
#1
Hi,

Typically aliasing is done by assigning the 'original' variable to some other variable. But I was exploring the intricacies of aliasing, and am wondering what might explain the following phenomenon:

>>> x = 5
>>> y = 5
>>> id(x) == id(y)
True
>>> x = 'hi'
>>> y = 'hi'
>>> id(x) == id(y)
True
>>> x = [1]
>>> y = [1]
>>> id(x) == id(y)
False
Thanks
Reply


Messages In This Thread
Intricacies of Aliasing - by ClassicalSoul - Mar-01-2019, 11:57 AM
RE: Intricacies of Aliasing - by snippsat - Mar-01-2019, 12:58 PM
RE: Intricacies of Aliasing - by scidam - Mar-01-2019, 01:53 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  signal anti-aliasing frohr 0 1,159 May-23-2022, 05:18 PM
Last Post: frohr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020