[issue41337] strangnedd with the parser

Steve Stagg report at bugs.python.org
Tue Jul 21 11:53:11 EDT 2020


Steve Stagg <stestagg at gmail.com> added the comment:

This appears to be a bug with the google colab site.

For whatever reason, if you try to evaluate a statement that is a line with  a leading comma (afaik, never valid python), then colab does something wierd by wrapping the arguments in quotes, and evaluating them ...

Here, `>>>` denotes running python in a colab cell:

>>> type(1)
int
>>> ,type(1)
str
>>> ,type(1,2,3)
str
>>> ,type(1, 2, 3)
---------------------------------------------------------------------------

TypeError                                 Traceback (most recent call last)

<ipython-input-38-a1b277d7db3e> in <module>()
----> 1 type("(1,", "2,", "3)")

TypeError: type.__new__() argument 2 must be tuple, not str

---

This is not reproducible in normal python, so seems extremely likely to be some (planned or unplanned) feature of google colab that's causing confusion here.

----------
nosy: +stestagg
status: pending -> open

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41337>
_______________________________________


More information about the Python-bugs-list mailing list