When I print deque object, all items are displayed. This is fine because I wanted to display all items But I was thinking object reference info will be displayed as below in this senario.
Question: How can you identify print(q)
display all items by definition in deque source code
I just want to know the reason and which source code allow print(q)
to display deque([1])
instead of <__main__.~ object at 0x~~~~~~~8>
I dont mean I want to display <__main__.~ object at 0x~~~~~~~8>
from collections import deque
q = deque()
q.append(1)
print(q)
# Actual output : deque([1])
# Output in my mind(which I imagined) : <__main__.~ object at 0x~~~~~~~8>