[omniORB] omniORB 4.0.7 and omniORBpy 2.7 soon

Duncan Grisby duncan at grisby.org
Fri Dec 30 23:14:20 GMT 2005


On Thursday 29 December, "Diez B. Roggisch" wrote:

> My holiday vacation made me miss this - is it too late to include my 
> __getitem__-patch for CORBA-structs? Just for remembrance: It introduced a 
> __getitem__-method on structs that made something like this possible:
> 
> some_tuple = (1,2,3)
> some_struct = SomeStruct(*some_tuple)
> some_tuple == tuple(some_struct) -> True

No, you're not too late. However, the more I think about it, the less
keen I am on the idea of being able to treat a struct like a sequence.
I think it's potentially confusing, and it could even break existing
working code.

Having said that, I certainly understand the value of being able to
extract the contents of a struct into a tuple. What I'd propose is to
add a method to structs (which now have a common base class), called
_tuple(), which returns the members as a tuple. Now your code would look
like:

 some_tuple = (1,2,3)
 some_struct = SomeStruct(*some_tuple)
 some_tuple == some_struct._tuple() -> True

What do you think of that?

Cheers,

Duncan.

-- 
 -- Duncan Grisby         --
  -- duncan at grisby.org     --
   -- http://www.grisby.org --



More information about the omniORB-list mailing list