Skip to content

Instantly share code, notes, and snippets.

@jamescalam
Last active June 10, 2021 18:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamescalam/589f59b38d784152cdbb5f80774a1248 to your computer and use it in GitHub Desktop.
Save jamescalam/589f59b38d784152cdbb5f80774a1248 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"metadata": {
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.0"
},
"orig_nbformat": 2,
"kernelspec": {
"name": "python3",
"display_name": "Python 3",
"language": "python"
}
},
"nbformat": 4,
"nbformat_minor": 2,
"cells": [
{
"source": [
"Missing parenthesis in 3.9:"
],
"cell_type": "markdown",
"metadata": {}
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"output_type": "error",
"ename": "SyntaxError",
"evalue": "unexpected EOF while parsing (<ipython-input-1-709fb9a68135>, line 1)",
"traceback": [
"\u001b[1;36m File \u001b[1;32m\"<ipython-input-1-709fb9a68135>\"\u001b[1;36m, line \u001b[1;32m1\u001b[0m\n\u001b[1;33m a_dict = {x: 1, y: 2, z: 3\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m unexpected EOF while parsing\n"
]
}
],
"source": [
"a_dict = {x: 1, y: 2, z: 3"
]
},
{
"source": [
"Missing parenthesis in 3.10:"
],
"cell_type": "markdown",
"metadata": {}
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"output_type": "error",
"ename": "SyntaxError",
"evalue": "'{' was never closed (<ipython-input-1-709fb9a68135>, line 1)",
"traceback": [
"\u001b[1;36m File \u001b[1;32m\"<ipython-input-1-709fb9a68135>\"\u001b[1;36m, line \u001b[1;32m1\u001b[0m\n\u001b[1;33m a_dict = {x: 1, y: 2, z: 3\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m '{' was never closed\n"
]
}
],
"source": [
"a_dict = {x: 1, y: 2, z: 3"
]
},
{
"source": [
"Unclosed string with 3.9:"
],
"cell_type": "markdown",
"metadata": {}
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"output_type": "error",
"ename": "SyntaxError",
"evalue": "EOL while scanning string literal (<ipython-input-2-2590875bc32e>, line 1)",
"traceback": [
"\u001b[1;36m File \u001b[1;32m\"<ipython-input-2-2590875bc32e>\"\u001b[1;36m, line \u001b[1;32m1\u001b[0m\n\u001b[1;33m a_str = 'hello world\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m EOL while scanning string literal\n"
]
}
],
"source": [
"a_str = 'hello world"
]
},
{
"source": [
"Unclosed string with 3.10:"
],
"cell_type": "markdown",
"metadata": {}
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"output_type": "error",
"ename": "SyntaxError",
"evalue": "unterminated string literal (detected at line 1) (<ipython-input-2-2590875bc32e>, line 1)",
"traceback": [
"\u001b[1;36m File \u001b[1;32m\"<ipython-input-2-2590875bc32e>\"\u001b[1;36m, line \u001b[1;32m1\u001b[0m\n\u001b[1;33m a_str = 'hello world\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m unterminated string literal (detected at line 1)\n"
]
}
],
"source": [
"a_str = 'hello world"
]
},
{
"source": [
"Assignment operator rather than comparison operator used in 3.9:"
],
"cell_type": "markdown",
"metadata": {}
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"output_type": "error",
"ename": "SyntaxError",
"evalue": "invalid syntax (<ipython-input-3-6efb04d16459>, line 1)",
"traceback": [
"\u001b[1;36m File \u001b[1;32m\"<ipython-input-3-6efb04d16459>\"\u001b[1;36m, line \u001b[1;32m1\u001b[0m\n\u001b[1;33m if 2 = 3:\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n"
]
}
],
"source": [
"if 2 = 3:\n",
" print('we have a problem')"
]
},
{
"source": [
"Assignment operator rather than comparison operator in 3.10:"
],
"cell_type": "markdown",
"metadata": {}
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"output_type": "error",
"ename": "SyntaxError",
"evalue": "cannot assign to literal here. Maybe you meant '==' instead of '='? (<ipython-input-3-6efb04d16459>, line 1)",
"traceback": [
"\u001b[1;36m File \u001b[1;32m\"<ipython-input-3-6efb04d16459>\"\u001b[1;36m, line \u001b[1;32m1\u001b[0m\n\u001b[1;33m if 2 = 3:\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m cannot assign to literal here. Maybe you meant '==' instead of '='?\n"
]
}
],
"source": [
"if 2 = 3:\n",
" print('we have a problem')"
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment