[IronPython] repr on c# class

Kamil Dworakowski kamil at dworakowski.name
Thu Jul 10 19:15:37 CEST 2008


Works, thank you

On 10 Jul 2008, at 17:56, Dino Viehland <dinov at exchange.microsoft.com>  
wrote:

> 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 re 
> quired that you implement it for it to work, you can just define a m 
> ethod 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
>
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20080710/81c0779b/attachment.html>


More information about the Ironpython-users mailing list