Skip to content

Commit 5e3c1c9

Browse files
committed
chapter8 finished
1 parent 4882432 commit 5e3c1c9

2 files changed

Lines changed: 352 additions & 11 deletions

File tree

chapter6/chapter6-动态类型简介.ipynb

Lines changed: 41 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,36 @@
309309
"print L4"
310310
]
311311
},
312+
{
313+
"cell_type": "markdown",
314+
"metadata": {},
315+
"source": [
316+
"- 注意,浅拷贝会创建一个新对象,但是它们的子对象还是指向统一对象"
317+
]
318+
},
319+
{
320+
"cell_type": "code",
321+
"execution_count": 9,
322+
"metadata": {},
323+
"outputs": [
324+
{
325+
"name": "stdout",
326+
"output_type": "stream",
327+
"text": [
328+
"True\n",
329+
"True\n",
330+
"True\n"
331+
]
332+
}
333+
],
334+
"source": [
335+
"L = [12**100, \"ij$#@%^&`\", [1 , 2, 3]]\n",
336+
"L_copy = L[:]\n",
337+
"print L[0] is L_copy[0]\n",
338+
"print L[1] is L_copy[1]\n",
339+
"print L[2] is L_copy[2]"
340+
]
341+
},
312342
{
313343
"cell_type": "markdown",
314344
"metadata": {},
@@ -325,7 +355,7 @@
325355
},
326356
{
327357
"cell_type": "code",
328-
"execution_count": 9,
358+
"execution_count": 10,
329359
"metadata": {},
330360
"outputs": [
331361
{
@@ -334,7 +364,7 @@
334364
"text": [
335365
"True\n",
336366
"False\n",
337-
"4382370272 4383269232\n"
367+
"4463899280 4463899424\n"
338368
]
339369
}
340370
],
@@ -348,7 +378,7 @@
348378
},
349379
{
350380
"cell_type": "code",
351-
"execution_count": 10,
381+
"execution_count": 11,
352382
"metadata": {},
353383
"outputs": [
354384
{
@@ -357,7 +387,7 @@
357387
"text": [
358388
"True\n",
359389
"True\n",
360-
"4383119048 4383119048\n"
390+
"4463834464 4463834464\n"
361391
]
362392
}
363393
],
@@ -371,7 +401,7 @@
371401
},
372402
{
373403
"cell_type": "code",
374-
"execution_count": 11,
404+
"execution_count": 12,
375405
"metadata": {},
376406
"outputs": [
377407
{
@@ -380,7 +410,7 @@
380410
"text": [
381411
"True\n",
382412
"True\n",
383-
"140654118206984 140654118206984\n"
413+
"140659321213288 140659321213288\n"
384414
]
385415
}
386416
],
@@ -395,7 +425,7 @@
395425
},
396426
{
397427
"cell_type": "code",
398-
"execution_count": 12,
428+
"execution_count": 13,
399429
"metadata": {},
400430
"outputs": [
401431
{
@@ -404,7 +434,7 @@
404434
"text": [
405435
"True\n",
406436
"False\n",
407-
"140654156174800 140654156174848\n"
437+
"140659321142176 140659321142224\n"
408438
]
409439
}
410440
],
@@ -425,16 +455,16 @@
425455
},
426456
{
427457
"cell_type": "code",
428-
"execution_count": 13,
458+
"execution_count": 14,
429459
"metadata": {},
430460
"outputs": [
431461
{
432462
"data": {
433463
"text/plain": [
434-
"2204"
464+
"2203"
435465
]
436466
},
437-
"execution_count": 13,
467+
"execution_count": 14,
438468
"metadata": {},
439469
"output_type": "execute_result"
440470
}

0 commit comments

Comments
 (0)