ITADN

WPS349 false positive with bytes slicing

#3635OpenimDarshanGK 创建于 2026-04-25
I
imDarshanGKcommented
## What's wrong WPS349 triggers a violation when slicing `bytes` objects, but it shouldn't because slicing and indexing return different types. ## Example ```python # For lists - slicing and indexing return same type: array = [1, 2, 3] array[0] # Returns: int array[0:1] # Returns: list[int] → WPS349 violation (CORRECT) # For bytes - they return DIFFERENT types: data = b"hello" data[0] # Returns: int data[0:1] # Returns: bytes → WPS349 violation (WRONG!)
0 条评论