QuantConnect / pythonnet

Python for .NET is a package that gives Python programmers nearly seamless integration with the .NET Common Language Runtime (CLR) and provides a powerful application scripting tool for .NET developers.
http://pythonnet.github.io
MIT License
28 stars 27 forks source link

Display String Representation in C# Objects Nested in List #69

Open AlexCatarino opened 2 years ago

AlexCatarino commented 2 years ago

Details

The print method in Jupyter doesn't display string from __repr__/__str__ when they are nested in a list:

qb = QuantBook()
tickers = ["ITA", "PPA", "XAR", "DFEN", "SHLD"]
symbols = []

for ticker in tickers:
    symbols.append(qb.AddEquity(ticker, Resolution.Daily).Symbol)

print(symbols)

Displays:

[<QuantConnect.Symbol object at 0x7f9b74b40608>,
 <QuantConnect.Symbol object at 0x7f9b7638ba48>,
 <QuantConnect.Symbol object at 0x7f9b746d7c08>,
 <QuantConnect.Symbol object at 0x7f9b746d71c8>,
 <QuantConnect.Symbol object at 0x7f9b746d7108>]

when it should:

['ITA', 'PPA', 'XAR', 'DFEN', 'SHLD']