This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Expected result is not clear in case of list.append(list)
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Lingaraj Gowdar, eric.smith, terry.reedy
Priority: normal Keywords:

Created on 2018-12-05 19:36 by Lingaraj Gowdar, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (3)
msg331148 - (view) Author: Lingaraj Gowdar (Lingaraj Gowdar) Date: 2018-12-05 19:36
Currently the output of below append cannot be used for practical purpose, This jira is to get the expectation for a case in append.

>>> a=[1,2]
>>> a.append(a)
>>> a
[1, 2, [...]]
>>>
msg331160 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2018-12-05 20:37
The ... denotes a recursive data structure, which is what you've created here by "a" including itself as an element. I'm not clear what you expected to see, but I'm going to close this because I don't see an actual problem here. If you think there's a bug in Python, please describe it here. Also make sure to include what you expect to see in addition to what you do see.
msg331178 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-12-05 21:49
Lingaraj: the fact that you use IDLE to run Python code, with the same binary executable that is running IDLE, does not make the result an IDLE issue.  (This is a common mistake of beginners who use IDLE.)

Anyway, an infinite string, the 'accurate' result, or an out-of-memory or recursion-depth exception, the original result of trying to print recursive data objects, is even less practical ;-).  This fix, a compact replacement, is intentional.
History
Date User Action Args
2022-04-11 14:59:08adminsetgithub: 79602
2018-12-05 21:49:18terry.reedysetassignee: terry.reedy ->
messages: + msg331178
components: + Interpreter Core, - IDLE
2018-12-05 20:37:49eric.smithsetstatus: open -> closed

nosy: + eric.smith
messages: + msg331160

resolution: not a bug
stage: resolved
2018-12-05 19:36:51Lingaraj Gowdarcreate