You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.1 KiB
62 lines
1.1 KiB
3 years ago
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 4,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"0, 1\n",
|
||
|
"1, 1\n",
|
||
|
"1, 2\n",
|
||
|
"1, 2\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"class A:\n",
|
||
|
" def s(self, *_):\n",
|
||
|
" print(\"A\")\n",
|
||
|
"\n",
|
||
|
"class B(A):\n",
|
||
|
" def s(self, a, b = 1, *_):\n",
|
||
|
" print(f'{a}, {b}')\n",
|
||
|
"\n",
|
||
|
"t = B()\n",
|
||
|
"t.s(0)\n",
|
||
|
"t.s(1)\n",
|
||
|
"t.s(1,2)\n",
|
||
|
"t.s(1,2,3)"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"metadata": {
|
||
|
"interpreter": {
|
||
|
"hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6"
|
||
|
},
|
||
|
"kernelspec": {
|
||
|
"display_name": "Python 3.10.2 64-bit",
|
||
|
"language": "python",
|
||
|
"name": "python3"
|
||
|
},
|
||
|
"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.2"
|
||
|
},
|
||
|
"orig_nbformat": 4
|
||
|
},
|
||
|
"nbformat": 4,
|
||
|
"nbformat_minor": 2
|
||
|
}
|