Given the following types (from sqlite3's tests):

    class L(object):
        def __len__(self):
            return 1
        def __getitem__(self, x):
            assert x == 0
            return "foo"

    class D(dict):
         def __missing__(self, key):
             return "foo"

Instances of these get passed in to a function implemented in C# and I
need to able to treat them the same as built-in types. The built-in
types happily implement either IList or IDictionary, so a cast will
suffice, but that doesn't work for custom objects or subclasses like
the above.

Is there anything built-in that can handle this? I trawled through
PythonOps looking for something but didn't find it. Something similar
to PythonOps.CreatePythonEnumerable that returns IList/IDictionary and
uses sequence/dictionary behaviour, I guess.

- Jeff
_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to