What is the ellipsis [...] in a Python list? -


i playing around in python. used following code in idle

p  = [1, 2] p[1:1] = [p] print p 

the output

[1, [...], 2] 

what […]? interestingly use list of list of list upto infinity i.e.

p[1][1][1].... 

i write above long wanted , still work.

edit:

  • how represented in memory?
  • what's use? examples of cases useful helpful.
  • any link official documentation useful.

it means created infinite list nested inside itself, can not printed. p contains p contains p ... , on. [...] notation way let know this, , inform can't represented! take @ @6502's answer see nice picture showing what's happening.

now, regarding 3 new items after edit:

  • this answer seems cover it
  • ignacio's link describes possible uses
  • this more topic of data structure design programming languages, it's unlikely reference found in python's official documentation

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -