[omniORB] Using enums as index into sequence types

Will Denissen Will.Denissen at asml.com
Mon Nov 26 17:40:10 GMT 2007


Dear Duncan,

Is it possible to extend the omniorb python language mapping such that enum
values can be used as an index of a sequence type, by
exploiting the new python 2.5 __index__ extension. It would allow me to do
something as shown below.

class EnumItem:
  def __init__(self, n, v):
    self._n = n
    self._v = v

  def __repr__(self):
    return self._n

  def __index__(self):
    return self._v

e1 = EnumItem('e1', 1)
e2 = EnumItem('e2', 3)

a = ['a','b','c','d']

print e1, a[e1], a[e1:e2]


Best regards,

Will Denissen


-- 
The information contained in this communication and any attachments is confidential and may be privileged, and is for the sole use of the intended recipient(s). Any unauthorized review, use, disclosure or distribution is prohibited.  Unless explicitly stated otherwise in the body of this communication or the attachment thereto (if any), the information is provided on an AS-IS basis without any express or implied warranties or liabilities.  To the extent you are relying on this information, you are doing so at your own risk.   If you are not the intended recipient, please notify the sender immediately by replying to this message and destroy all copies of this message and any attachments. ASML is neither liable for the proper and complete transmission of the information contained in this communication, nor for any delay in its receipt. 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20071126/45f32a42/attachment.htm


More information about the omniORB-list mailing list