[IronPython] repr on c# class

Dino Viehland dinov at exchange.microsoft.com
Thu Jul 10 18:56:36 CEST 2008


This is 1.x, correct?  You should implement the ICodeFormattable interface.  That is also present in 2.0 but in 2.0 it's no longer required that you implement it for it to work, you can just define a method named __repr__.

From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Kamil Dworakowski
Sent: Thursday, July 10, 2008 9:53 AM
To: Discussion of IronPython
Subject: [IronPython] repr on c# class

I need to define repr method in c#, for use in IronPython. I tried:

       [PythonName("repr")]
        public static object Repr(object o) {
            return o.ToString();
        }


which didn't work. Is there a way without subclassing in Python?

--
Kamil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20080710/d57ab814/attachment.html>


More information about the Ironpython-users mailing list