[New-bugs-announce] [issue30086] type() and len() recognize "abc", expression as "abc" string.

umedoblock report at bugs.python.org
Mon Apr 17 00:43:18 EDT 2017


New submission from umedoblock:

But I found a real bug to use a tuple with a comma.

Python3 recognized "abc", expression as tuple of one element.
But type() and len() recognize "abc", expression as "abc" string.
So now, I found a real bug.

I'll show you below sentences.

>>> "abc",
('abc',)
>>> obj = "abc",
>>> obj
('abc',)
>>> type(obj)
<class 'tuple'>
>>> len(("abc",))
1
>>> len(obj)
1

>>> type("abc",)
<class 'str'>
>>> len("abc",)
3

----------
components: Regular Expressions
messages: 291781
nosy: ezio.melotti, mrabarnett, umedoblock
priority: normal
severity: normal
status: open
title: type() and len() recognize "abc", expression as "abc" string.
type: behavior
versions: Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30086>
_______________________________________


More information about the New-bugs-announce mailing list