[omniORB] EnumItem problems in omniORBpy2.3

Thomas Lockhart lockhart at fourpalms.org
Tue Feb 10 09:57:13 GMT 2004


(Non-authoritative answer)

The CORBA Python language mapping is a bit terse when it comes to 
enumerated types. It does say:

"An application may only test for equivalence of two enumeration values, 
and not assume that they behave like numbers."

That doesn't address behaviors around "None", but istm that set 
ownership should be testable. So

if (yourvar in DIANE_CORBA.ok): do something...

should be possible, and you should be able to cast your tests in that 
form, aside from other possible restrictions. That doesn't appear to work:

 >>> x = DIANNE_CORBA.ok
 >>> x in DIANNE_CORBA.task_status_t
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
TypeError: iterable argument required

You can just catch the exception:

 >>> try:
...   x == None
... except:
...   print "no way"
...
no way

Duncan, is there any motivation to extend the behavior of enumerated 
types to cover these cases gracefully? Any reason to stay away from 
doing that?

hth

                          - Tom




More information about the omniORB-list mailing list