Results 1 to 2 of 2

Thread: IcePy: Accept integers where floats are expected

  1. #1
    cebix is offline Registered User
    Name: Christian Bauer
    Organization: AREVA NP
    Project: Diagnostics frontend for industrial I&C
    Join Date
    Jun 2007
    Location
    Erlangen, Germany
    Posts
    10

    IcePy: Accept integers where floats are expected

    (Using Ice 3.3.1 on Linux)

    Consider this Slice definition:
    Code:
    module Demo {
        struct Value {
            float v;
        };
    
        interface Printer {
            void printFloat(float f);
            void printValue(Value v);
        };
    };
    In a Python client it's not possible to call printFloat() with an integer argument or use an integer value for the data member of the Value structure:
    Code:
    >>> printer.printFloat(42)
    ValueError: invalid value for argument 1 in operation `printFloat'
    >>> v = Demo.Value(42)
    >>> printer.printValue(v)
    ValueError: invalid value for ::Demo::Value member `v'
    Such a strict type validation is very unusual and inconvenient for Python. IMHO, IcePy should implicitly convert integers to floats in these cases.

  2. #2
    mes's Avatar
    mes
    mes is offline ZeroC Staff
    Name: Mark Spruiell
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Feb 2003
    Location
    California
    Posts
    1,441
    Quote Originally Posted by cebix View Post
    Such a strict type validation is very unusual and inconvenient for Python. IMHO, IcePy should implicitly convert integers to floats in these cases.
    Agreed, we'll fix this.

    Thanks,
    Mark

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Using numpy arrays where a sequence is expected
    By gwvdlinden in forum Help Center
    Replies: 3
    Last Post: 10-16-2009, 06:45 PM
  2. confirming expected.
    By OrNot in forum Help Center
    Replies: 1
    Last Post: 10-24-2005, 07:01 AM
  3. Unsigned integers
    By Wyzard in forum Help Center
    Replies: 5
    Last Post: 01-25-2005, 11:53 PM
  4. accept stopped when drop out wire in java
    By yomi in forum Help Center
    Replies: 3
    Last Post: 11-07-2004, 07:16 PM
  5. Unsigned Integers
    By tony_h in forum Help Center
    Replies: 2
    Last Post: 09-21-2004, 04:10 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •