[IronPython] Better dir() for Enum

Dino Viehland dinov at exchange.microsoft.com
Thu Jun 1 03:23:05 CEST 2006


I like the __doc__ idea a lot.  I don't think we want to go changing the semantics of dir, but obviously we can put anything we want in __doc__.

We're also planning in finally implementing help(), which would also presumably include this info, so ulitmately it'll only be one more character than dir().
________________________________________
From: users-bounces at lists.ironpython.com On Behalf Of Sanghyeon Seo
Sent: Wednesday, May 31, 2006 6:14 PM
To: Discussion of IronPython
Subject: [IronPython] Better dir() for Enum

Let's illustrate this feature request with an interactive session:

>>> import System

>>> dir(System.IO.FileMode)
['Append', 'CompareTo', 'Create', 'CreateNew', 'Equals', 'Finalize',
'Format', 'GetHashCode', 'GetName', 'GetNames', 'GetType',
'GetTypeCode', 'GetUnderlyingType', 'GetValues', 'IsDefined',
'MemberwiseClone', 'Open', 'OpenOrCreate', 'Parse', 'ToBoolean',
'ToByte', 'ToChar', 'ToDateTime', 'ToDecimal', 'ToDouble', 'ToInt16',
'ToInt32', 'ToInt64', 'ToObject', 'ToSByte', 'ToSingle', 'ToString',
'ToType', 'ToUInt16', 'ToUInt32', 'ToUInt64', 'Truncate', '__class__',
'__init__', '__module__', '__repr__', 'value__']

>>> sorted(System.Enum.GetNames(System.IO.FileMode))
['Append', 'Create', 'CreateNew', 'Open', 'OpenOrCreate', 'Truncate']

I think there's no doubt that the later output is more useful. But I'm
not sure whether this feature request interferes with other possible
features of IronPython.

If the above is undesirable, at least this could be improved:

>>> print System.IO.FileMode.__doc__
no documentation available

Seo Sanghyeon
_______________________________________________
users mailing list
users at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 4466 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20060531/4fa29509/attachment.bin>


More information about the Ironpython-users mailing list