Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6838701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:37:44+00:00 2026-05-26T23:37:44+00:00

I have a slight problem understanding the behaviour of lists. My exercise question is:

  • 0

I have a slight problem understanding the behaviour of lists.

My exercise question is:
Draw a memory model showing the effect of the following statements:

values = [0, 1, 2]
values[1] = values

My thinking was that executing these statements will change the list to something like this [0, [0, 1, 2], 3]
, in other words second statement will append the second value in the list(1) but when I execute these statements and then print out the list in Python shell (3.2) I get following result:

[0, [...], 2]

Something has happened to second entry but I’m not sure exactly what, can someone explain what has happened?

Thank you,
Damian

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T23:37:44+00:00Added an answer on May 26, 2026 at 11:37 pm

    You’ve created a recursive data structure. The second element in the list is a reference to the list itself. When you print this out, normally you would expect to see the original list in the second place, as you suggest in your question.

    However, you aren’t inserting a copy of the original list, you are inserting a reference to the actual list. So, the second element must print out the whole list. But, the second element of this second element is itself a reference to the list, so when it prints its second element, …. Python gracefully handles this by displaying [...] since the only other solution is to present an infinite set of nested lists.

    Imagine it this way: after your assignment to values[1], your list can be thought of to look like this:

    [0, <pointer to itself>, 2]
    

    Of course, <pointer to itself>, when printed out, looks like:

    [0, <pointer to itself>, 2]
    

    When you put those together, you get:

    [0, [0, <pointer to itself>, 2], 2]
    

    But of course, to print that innermost <pointer to itself> it, too, must be printed:

    [0, [0, [0, <pointer to itself>, 2], 2], 2]
    

    … and so on. It’s turtles all the way down.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

am new here. i have a slight problem; PLease look at the following code
I have a slight problem with a path: D:\\Music\\DJ Ti%C3%ABsto\\Tiesto\\Adagio For Strings (Spirit of
I have a slight problem... we made a change to our url structure the
I have a slight problem, I am trying to capture the input of two
I've wrote this simple piece of code. And I have a slight problem with
hey everyone, here is the site SEE BELOW I have a slight jquery problem
I have a slight problem and cannot for the life of me figure out
I have a slight problem with .htaccess redirect. I have a dynamic site with
I have a slight problem, I'm making a dropdown using the help from someone
I am very new to Git and I have a slight problem. In SVN

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.