Skip to content

Difference between C# ToString and python __str__ for lists #25

@koubaa

Description

@koubaa

In python, if you have a list and you convert it to string via str(my_list), it will print out the entire list.
With C#, calling .ToString() on either an array or a List object will just print out that it is a list.

This leads to a difference in behavior between APIs exposed via CPython and APIs exposed by IronPython. With IronPython, a python list is internally a C# List, but it's __str__ method matches the behavior of a python list.

There should be an option in ansys-pythonnet to provide pythonic string conversions for C# collections.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions