source code size metric: Python and modern C++

David Abrahams dave at boost-consulting.com
Wed Dec 4 09:16:12 EST 2002


Brian Quinlan <brian at sweetapp.com> writes:

> Is there some way to hack a type-safe container of mixed-types with
> an easy to use interface?

Lots of ways, and many are not even hacks <wink>. 

> For example, my XML-RPC function could do this:
>
> def things():
> 	return ['apple', 5, 6.3, {'foo' : 'bar'}, [[[3]]]]
>
> Processing that in XML-RPC C would be very painful. How would you do it?

One of these might suit:

  boost::tuple<
        std::string, int, float,
            std::map<std::string,std::string>, 
            std::vector<std::vector<std::vector<int> > > >

or

  std::vector<boost::any>


>> There are lots of variations. Here's another:
>> 
>> ServerProxy.call_method("add", (arg_tuple(5), 5.6, 7, "hello"));
>
> That's disgusting :-)

so is (a and [b] or [c])[0] <wink>

-- 
                       David Abrahams
   dave at boost-consulting.com * http://www.boost-consulting.com
Boost support, enhancements, training, and commercial distribution





More information about the Python-list mailing list