Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List reference not working properly #90303

Closed
antarab mannequin opened this issue Dec 21, 2021 · 2 comments
Closed

List reference not working properly #90303

antarab mannequin opened this issue Dec 21, 2021 · 2 comments
Labels
type-bug An unexpected behavior, bug, or error

Comments

@antarab
Copy link
Mannequin

antarab mannequin commented Dec 21, 2021

BPO 46145

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2021-12-21.17:46:47.368>
created_at = <Date 2021-12-21.17:24:44.985>
labels = ['type-bug']
title = 'List reference not working properly'
updated_at = <Date 2021-12-21.17:46:47.367>
user = 'https://bugs.python.org/antarab'

bugs.python.org fields:

activity = <Date 2021-12-21.17:46:47.367>
actor = 'antarab'
assignee = 'none'
closed = True
closed_date = <Date 2021-12-21.17:46:47.368>
closer = 'antarab'
components = []
creation = <Date 2021-12-21.17:24:44.985>
creator = 'antarab'
dependencies = []
files = []
hgrepos = []
issue_num = 46145
keywords = []
message_count = 2.0
messages = ['408998', '408999']
nosy_count = 1.0
nosy_names = ['antarab']
pr_nums = []
priority = 'normal'
resolution = None
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue46145'
versions = []

@antarab
Copy link
Mannequin Author

antarab mannequin commented Dec 21, 2021

o= [1,2,3,3]
print('o:',id(o))
d= o
print('d:',id(d))
d= [1,2,3,4]
dd= o
print('dd:',id(dd))
dd[3]= 5

print('o:',o)
print('d:',d)
print('dd:',dd)

=======================
Output:
o: 1976210449032
d: 1976210449032
dd: 1976210449032
o: [1, 2, 3, 5]
d: [1, 2, 3, 4]
dd: [1, 2, 3, 5]

Though o,d and dd points to the same memory pointer but d has different value. How can same memory location points to 2 different values?

@antarab antarab mannequin added type-bug An unexpected behavior, bug, or error labels Dec 21, 2021
@antarab
Copy link
Mannequin Author

antarab mannequin commented Dec 21, 2021

Not an issue

@antarab antarab mannequin closed this as completed Dec 21, 2021
@antarab antarab mannequin closed this as completed Dec 21, 2021
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

0 participants