Skip to content

Commit 24f3364

Browse files
committed
Deleter
1 parent 340a9c2 commit 24f3364

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

Employee Getter & Sette.ipynb

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,27 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 16,
5+
"execution_count": 20,
66
"metadata": {},
77
"outputs": [
88
{
99
"name": "stdout",
1010
"output_type": "stream",
1111
"text": [
1212
"Soumyadip Chowdhury [email protected] 900000\n",
13-
"Soumyadip Chowdhury [email protected] 100000\n",
14-
"Soumya Dip [email protected] 900000\n",
1513
"Soumyadip Chowdhury [email protected] 100000\n"
1614
]
15+
},
16+
{
17+
"ename": "AttributeError",
18+
"evalue": "can't set attribute",
19+
"output_type": "error",
20+
"traceback": [
21+
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
22+
"\u001b[1;31mAttributeError\u001b[0m Traceback (most recent call last)",
23+
"\u001b[1;32m<ipython-input-20-e4694631b8cb>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m 24\u001b[0m \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0memp_2\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0msetterEx\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 25\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 26\u001b[1;33m \u001b[0memp_1\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0msetterEx\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;34m\"Soumya Dip\"\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 27\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 28\u001b[0m \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0memp_1\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0msetterEx\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
24+
"\u001b[1;31mAttributeError\u001b[0m: can't set attribute"
25+
]
1726
}
1827
],
1928
"source": [
@@ -34,6 +43,12 @@
3443
" first, last=name.split(' ')\n",
3544
" self.first=first\n",
3645
" self.last=last\n",
46+
" \n",
47+
" @setterEx.deleter \n",
48+
" def setterEx(self, name):\n",
49+
" print(\"Deleting\")\n",
50+
" self.first=first\n",
51+
" self.last=last\n",
3752
" \n",
3853
"emp_1=Employee(\"Soumyadip\",\"Chowdhury\",900000)\n",
3954
"emp_2=Employee(\"Soumyadip\",\"Chowdhury\",100000)\n",

0 commit comments

Comments
 (0)