fake-bpy-module icon indicating copy to clipboard operation
fake-bpy-module copied to clipboard

bpy_prop_collection.__getitem__() should accept slice too

Open JonathanPlasse opened this issue 1 year ago • 0 comments

bpy_prop_collection.__getitem__() can use slice, but is not present in the type hint.

def __getitem__(self, key: typing.Optional[typing.Union[int, str]]
                    ) -> 'GenericType':
        ''' 

        :param key: 
        :type key: typing.Optional[typing.Union[int, str]]
        :rtype: 'GenericType'
        '''
        ...

Adding slice would fix this issue.

def __getitem__(self, key: typing.Optional[typing.Union[int, str, slice]]
                    ) -> 'GenericType':
        ''' 

        :param key: 
        :type key: typing.Optional[typing.Union[int, str, slice]]
        :rtype: 'GenericType'
        '''
        ...

To fix this, should Blender documentation be updated?

JonathanPlasse avatar Dec 17 '23 13:12 JonathanPlasse