5. Tuples, Lists, Aliasing, Mutability, and Cloning

5. Tuples, Lists, Aliasing, Mutability, and Cloning

MIT OpenCourseWare

7 лет назад

222,322 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Xpeedspiderman
Xpeedspiderman - 08.11.2023 10:05

I found something wrong which q=0 is right but the r = 4 is not true .

Ответить
Neil Menezes
Neil Menezes - 02.10.2023 09:16

Loved the Photo of Justin Bieber being credited to © Justin Bieber in the end 😂

Ответить
Mark milan
Mark milan - 05.09.2023 14:49

I thought python runs from up to down. Your lists mutability shows down to up.

Ответить
Jason Zhang
Jason Zhang - 27.07.2023 19:10

Thanks for the video. It really helps me to fully understand the difference between a tuple and a list.

Ответить
Jyv Ben
Jyv Ben - 14.07.2023 19:33

Sadly we never see where she is pointing to, makes it a bit more difficult to follow, showing her waiving her arm is useless.
Hope the latest videos produced by MIT fix this (if any), maybe some bright spark can solve it or solved it.
And give her some rubber bands to keep her shirt sleeves up ?

Ответить
JK's Den
JK's Den - 21.03.2023 16:54

no idea what is going on when using laser pointer to point at the physical screen where couldn't see in this video.

Ответить
Loptr Fawkes
Loptr Fawkes - 17.02.2023 20:45

I'll make a comment on it, since for some reason this really confused me: why .sort() returns none. (If I get something wrong, feel free to correct me and I will edit this comment, I am new to coding.)

The reason that list.sort() and list.reverse() return None, while sorted(list) returns a list's values, is basically that the methods are completed by different means. Code that returns None is completed "in-place," which means that the original variable itself is not duplicated, only changed. Python does not want you to think that a new variable has been/could be created after running the method .sort() or .reverse() (or any other in-place method), and so it returns None. It is basically telling you that any method that is done in-place CANNOT generate a new variable because it has not duplicated the old variable.

Meanwhile, sorted(list) is creating a new list entirely, and so you can assign it to a new variable name. ( sortedList = sorted(originalList) )

So basically, don't assign in-place methods to any new variables.

Ответить
Ryan S
Ryan S - 30.12.2022 10:17

Thanks for this! Mutable side effects are annoying! x_x

Ответить
bunty yadav
bunty yadav - 15.12.2022 13:50

Bad way to learn programming...

Ответить
syrinesyrinesyrine
syrinesyrinesyrine - 16.08.2022 14:05

This is very hard to follow. She's showing slides that we can see for only a few seconds. She then points at them, refer to them and says "this" a lot but we cannot see what she is pointing at anymore...

Ответить
Infinitas Fish
Infinitas Fish - 23.05.2022 14:33

Thank You very much!

Ответить
F Wily
F Wily - 23.03.2022 03:48

So why would I pay a ton of money for this?

Ответить
Abhishek Banerjee
Abhishek Banerjee - 27.02.2022 21:59

I have a confusion, If tuples are immutable how does nums = nums + (t[0],) work?

Ответить
Elias Medina
Elias Medina - 26.01.2022 17:27

So, if you make a variable, equal to another variable, you are creating an alias. So, if var1 = var2, then var1 points to the same memory address as var2, making it a pointer to var2. Coming from c++ it seems weird that when assigning var1 to var2, it makes a pointer, instead of a copy. And instead, having to specify when do you want a copy... But it's ok, as python's thing is being syntactically simple and it also reduces the garbage to collect, etc, etc.

Ответить
x
x - 05.01.2022 03:21

Dr Ana Bell is absolutely phenomenal at what she does. What an amazing explanation again. I can't believe MIT has such high quality content up there available for free.

Ответить
Iain Brookes
Iain Brookes - 12.12.2021 06:31

Great tutor and lessons however I would like a picture in picture of her and to be able to see what she is pointing at on the screen. hard to follow when you cannot see what she is pointing at.

Ответить
Han J
Han J - 07.12.2021 23:18

For the last L1, L2 question, I've tried it with the first code but got L1 = [2, 3]. Is that because Python has been updated to fix that issue??

Ответить
Bikash Subedi
Bikash Subedi - 26.10.2021 17:58

this video introduced Justin Bieber to me

Ответить
Mil Dot
Mil Dot - 24.10.2021 12:31

Why she's all time walking left right .. after 2-3 phrases she returns to her computer and camera man ... suck .i don't need to see her .. she's boring

Ответить
OBLI
OBLI - 11.10.2021 12:50

Obli is getting progress

Ответить
Hossainur Rahman
Hossainur Rahman - 11.10.2021 05:36

Mam is very beautiful

Ответить
Joost
Joost - 29.09.2021 16:57

Ana explains all the theory very clear. Already knew most of the python she explains but it still helped me understand the big picture of programming

Ответить
Jaime Montero
Jaime Montero - 13.09.2021 07:25

Good lectures , clear slides and Dr. Ana Bell very , very good professor .
Tanks MIT to give us thats extraordinarys open courses .

Ответить
Bac Tran
Bac Tran - 04.08.2021 17:01

so Python knows to map min_n and max_n to min_year and max_year....?

Ответить
OBSERVATIONS
OBSERVATIONS - 03.08.2021 15:18

Thank you mit open course to provide us wonderful lectures .
🇺🇸 ❤ 🇮🇳

Ответить
Russell Fatemi
Russell Fatemi - 10.07.2021 08:34

Thank you professor Bell

Ответить
CrushOfSiel
CrushOfSiel - 15.06.2021 23:03

Darn, a lot of this information would have been great to do the hangman assignment! I did it all with strings and it was a bit challenging and probably hard for another programmer to follow in some areas. Lists are awesome.

Ответить
Yong Sheng Tay
Yong Sheng Tay - 09.06.2021 21:23

Comparing the current course available on edx and this, I still prefer the full lecture length videos from Fall '16. It's a lot more compact but it's easier to stay focused.

Ответить
TheFootballPlaya
TheFootballPlaya - 05.06.2021 12:03

great video. python, while it's syntax is simple, that simplicity in some ways serves to detract from what is actually happening and how things are processed. It's more apparent when you compare python operations to something like that of c++, where you realize how much python does for you. Other than information hiding, it's a lovely language.

Ответить
Nancy Lu
Nancy Lu - 29.03.2021 00:36

Wonderful! learned a lot! (It would be great if the camera man focused on the slides when Dr.Bell was pointing at them.)

Ответить
craigdanielmaceacher
craigdanielmaceacher - 06.03.2021 14:47

FYI don’t use capital “L” as a name, or capital L for anything in python code, it’s not idiomatic python, use a more descriptive name, and avoid capital letters, especially single capital letters. I understand why they did it though, for an example you don’t need a long name and lowercase “l” is hard to discern from the number 1 with a lot of fonts. Get yourself a monospaced programming font like Hack to help!

Ответить
Brainstorming & sharing
Brainstorming & sharing - 19.02.2021 12:12

👍👍👍👍👍

Ответить
Frank Huang
Frank Huang - 02.02.2021 05:44

Thank you MIT for providing such invaluable content to the public! Thank you!

Ответить
Agha Muhammad Aslam
Agha Muhammad Aslam - 02.01.2021 21:46

It would be better if the Slide and the lecturer are split in a video

Ответить
edderiofer
edderiofer - 02.12.2020 02:55

In that last example, couldn't one iterate through the list backwards?

Ответить
Yusuf Mohammed
Yusuf Mohammed - 08.11.2020 19:42

That's the only thing I don't like about these videos...when the professor is calling attention to something on the board the camera person just keeps staring at the professor. Can we see what's she's referring to? It's kinda frustrating.

Ответить
Norgileat Monseaur
Norgileat Monseaur - 30.09.2020 22:14

Ah yes, when a concept is being explained the logical course of action is to quickly cut away from the slides.

Ответить
Imas 123
Imas 123 - 11.09.2020 07:01

I ( we ) need a course from u just to define all these different words you use in most of ur analysis? ???

Ответить