On 10 Oct 2013, at 17:36, Jeff Hardy <jdha...@gmail.com> wrote: > I haven't looked at the implementation of len() yet, so I could be > wrong, but my guess is that if your object doesn't implement IList (or > something else with .Count) it will look for a __len__ method > (http://bit.ly/16TDkIJ) on the object. This should be reified as a > call to TryGetMember/TryInvoke, so you should be able to selectively > provide __len__ for those objects that are collections and leave it > out for those that are not.
In my tests, it wasn't trying to resolve __len__ on the dynamic object (I specifically tracked everything going through in case this was the solution). For now, I'll just return an IList-implementing separate DynamicObject subclass when appropriate. Thanks, Nick _______________________________________________ Ironpython-users mailing list Ironpython-users@python.org https://mail.python.org/mailman/listinfo/ironpython-users