<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7036.0">
<TITLE>Using enums as index into sequence types</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->

<P><FONT SIZE=2 FACE="Arial">Dear Duncan,</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">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</FONT></P>

<P><FONT SIZE=2 FACE="Arial">exploiting the new python 2.5 __index__ extension. It would allow me to do something as shown below.</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">class EnumItem:</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp; def __init__(self, n, v):</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; self._n = n</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; self._v = v</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">&nbsp; def __repr__(self):</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; return self._n</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">&nbsp; def __index__(self):</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; return self._v</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">e1 = EnumItem('e1', 1)</FONT>

<BR><FONT SIZE=2 FACE="Arial">e2 = EnumItem('e2', 3)</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">a = ['a','b','c','d']</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">print e1, a[e1], a[e1:e2]</FONT>
</P>
<BR>

<P><FONT SIZE=2 FACE="Arial">Best regards,</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">Will Denissen</FONT>
</P>

<br clear=all> -- 
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. 
</BODY>
</HTML>