示例#1
0
        public bool TryDecode <T>(PyObject pyObj, out T value)
        {
            if (!PyIter.IsIterable(pyObj))
            {
                value = default;
                return(false);
            }

            using (var pyList = PyList.AsList(pyObj))
            {
                if (typeof(T).IsGenericType)
                {
                    value = pyList.ToList <T>();
                }
                else
                {
                    value = (T)pyList.ToList();
                }
                return(true);
            }
        }