Skip to content

Long Python lists are not shortened when printed in terminal #2141

@david-cortes

Description

@david-cortes

It seems long Python objects are not truncated when printed in the terminal in interactive mode, such as lists for example. This is problematic when dealing with large objects, as it takes a long time to print them in the console and might lead the system to crash.

Steps to reproduce:

  • Initialize a long Python list
  • Print it in the editor

Expected behavior:

  • Should truncate the outputs to print to something reasonable.

Acutal behavior:

  • Prints the whole object regardless of size.

Example code (e.g. type in VS Code, select all, press Shift + Enter):

import numpy as np
a = np.random.normal(size = 10**7)
a.tolist()

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions