PYTH 1.2 NO IDEA Avatar
  1. OMG Issue

PYTH12 — Problem with Python Language Mapping

  • Key: PYTH12-4
  • Legacy Issue Number: 4315
  • Status: closed  
  • Source: Raytheon ( Craig Rodrigues)
  • Summary:

    I'd like to point out some errors in the Python Language Mapping
    document, ftp://ftp.omg.org/pub/docs/formal/01-02-66.pdf,
    section 1.3.9 "Mapping for an Any".

    The example which accompanies the text for this section
    is vague, contains errors, and is confusing to someone who
    is trying to learn how to use Anys in the Python Language Mapping.
    For discussion of some of the errors in this example, refer to
    the following messages on the omniORB mailing list:
    http://www.uk.research.att.com/omniORB/archives/2001-04/0139.html
    http://www.uk.research.att.com/omniORB/archives/2001-04/0140.html

    I believe the example is broken in many ways, and should
    be re-written to more clearly illustrate how to use Anys
    with the Python Language Mapping.

    I have re-written the example as follows:

    ========================================================================
    import CORBA
    import M

    1. Create a value of type M.S
      v = M.S(1, CORBA.TRUE)
    2. obtain type code
      tc=CORBA.TypeCode( CORBA.id(M.S) )
    3. could also use: tc1=CORBA.TypeCode("IDL:M/S:1.0")
    1. Create any containing an M.S object
      any1 = CORBA.Any(tc, v)
      1. the TypeCodes for the basic CORBA types are defined
      2. in the CORBA 2.4 standard, section 10.7.2 "TypeCode Constants"
    1. Create any containing CORBA Long
      any2 = CORBA.Any(CORBA.TC_long, 1)
    2. Create any containing CORBA Float
      any3 = CORBA.Any(CORBA.TC_float, 3.14)
    3. Create any containing CORBA Float
      any4 = CORBA.Any(CORBA.TC_short, 5)
    4. Create any containing CORBA unsigned
      any5 = CORBA.Any(CORBA.TC_ushort, 6)
    5. Create any containing CORBA String
      any6 = CORBA.Any(CORBA.TC_string, "some string")

    o = something() # somehow obtain reference to object of type M.foo

    o.operate( any1 )
    o.operate( any2 )
    o.operate( any3 )
    .
    .
    .

    ========================================================================

    I believe that it is imperative that this example be changed in
    Section 1.3.9 of the Python Language Mapping.

  • Reported: PYTH 1.1 — Mon, 21 May 2001 04:00 GMT
  • Disposition: Resolved — PYTH 1.2
  • Disposition Summary:

    Accept the suggested rewrite of the examples

  • Updated: Fri, 6 Mar 2015 20:58 GMT