-
-
Notifications
You must be signed in to change notification settings - Fork 33.1k
Closed as not planned
Closed as not planned
Copy link
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
# Add a code block here, if required
class L (list):
def __new__ (cls,value):
if isinstance(value,str):
if ',' in value:
collect = []
for item in value.split(','):
collect.append(item)
value = collect
return super().__new__(cls,value)
print(L("1,2"))
Expected output: ['1', '2']
Got instead: ['1', ',', '2']
If I don't cast the return value, I get the correct value but the type would not be what I want.
CPython versions tested on:
3.13
Operating systems tested on:
macOS
Metadata
Metadata
Assignees
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error