[Python-Dev] Broader iterable support for xmlrpclib

skip@pobox.com skip at pobox.com
Wed Dec 7 15:27:38 CET 2005


    >> I then proposed the even wackier idea to simply allow all currently
    >> unsupported iterables (sets and arrays seem the most obvious
    >> candidates to me) to be marshalled as lists

    Raymond> Doesn't the appropriate conversion depend on the contract
    Raymond> between the sender and receiver (i.e. an array of type 'c' may
    Raymond> either be converted as list(arr) or arr.tostring() depending on
    Raymond> the app)?  Is the goal to save writing explicit conversions by
    Raymond> presuming that most iterables aspire to be lists for transport
    Raymond> purposes?

Sure, I suspect it depends on the contract.  The contract my patch enforces
is whether or not list(obj) succeeds.  If that fails, a TypeError is raised
as before.  If it succeeds incorrectly, I suspect the programmer will figure
that out soon enough and make the appropriate adjustment.  In the common
case though, I suspect it will work though.  As indicated in the patch
submission, the goals are to:

  * extend the set of sequences that can be marshalled transparently

  * keep the caller from caring as much about the limitations of the XML-RPC
    datatypes

Skip


More information about the Python-Dev mailing list