Example #1
0
        public override IMember Index(IPythonInstance instance, object index)
        {
            var n = PythonCollection.GetIndex(index);

            if (n < 0)
            {
                n = ItemTypes.Count + n; // -1 means last, etc.
            }
            if (n >= 0 && n < ItemTypes.Count)
            {
                return(ItemTypes[n]);
            }
            return(UnknownType);
        }
Example #2
0
        public override IMember Index(IPythonInstance instance, IArgumentSet args)
        {
            var n = PythonCollection.GetIndex(args);

            if (n < 0)
            {
                n = ItemTypes.Count + n; // -1 means last, etc.
            }
            if (n >= 0 && n < ItemTypes.Count)
            {
                var t = ItemTypes[n];
                return(t.CreateInstance(args));
            }
            return(UnknownType);
        }