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

Raymond Hettinger report at bugs.python.org
Mon Apr 17 00:55:21 EDT 2017


Raymond Hettinger added the comment:

What you're seeing is a feature of the grammar.

Function allow an optional trailing comma in the argument list:

    >>> pow(2, 5)
    32
    >>> pow(2, 5,)
    32

So, to create a tuple inside in an argument list, you need the extra layer of parentheses.

Sorry, this isn't a real bug.  It is just a conflict resolution between use of a comma to separate arguments in a function call and use of a comma to create a tuple.

----------
nosy: +rhettinger
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

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


More information about the Python-bugs-list mailing list