[IronPython] repr() results with uint, etc.

Jeff Slutter jslutter at reactorzero.com
Sat Feb 7 06:32:32 CET 2009


Ok, looking at the source, I see the issue in:

public static string Repr(CodeContext/*!*/ context, object o)

Is it safe to add these types in to there like:
            if ((s = o as string) != null) return StringOps.__repr__(s);
            if (o is int) return Int32Ops.__repr__((int)o);
            if (o is uint) return ((uint)o).ToString();
            if (o is long) return ((long)o).ToString() + "L";
            if (o is ulong) return ((ulong)o).ToString() + "UL";
            if (o is byte) return ((byte)o).ToString();
            if (o is sbyte) return ((sbyte)o).ToString();
            if (o is char) return ((char)o).ToString();
            if (o is Int16) return ((Int16)o).ToString();
            if (o is UInt16) return ((UInt16)o).ToString();
?


Jeff Slutter wrote:
> I have functions (in C#) that return results as everything from byte,
> sbyte, System.UInt16, int, uint, float, etc.
> 
> If I use repr() on the returned value within IP2.0 only bool, int,
> int64, float, double and string types print out a nice value using repr.
> 
> The other types (byte, char, sbyte, uint16, int16, uint, uint64) all
> print out like:
> <System.UInt32 object at 0x000000000000002B [5]>
> 
> 
> Is there a way to get repr to print out a nice result like int types?
> (some way from inside IronPython, a different version of repr?)
> 
> Thanks,
> Jeff
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> 




More information about the Ironpython-users mailing list