Python 101 #3 - Memory management, Stack and Heap, Object Mutability

preview_player
Показать описание
Python 101 is a beginner programming course designed to introduce you to Computer Science and Object-oriented programming.

In this video, we are going to define primitive data types in Python and learn how to declare variables.

Рекомендации по теме
Комментарии
Автор

This video is so underrated. Thanks for great explanation.

hieudoan
Автор

great video just 1 small pedantic statement. id() returning the memory address of an object is an implementation detail in CPython. the only gaurentee is it returns a unique identifier, but it specifically being a memory address is not guaranteed by language specification

alexa.
Автор

Great video! Clear and concise explanation. The fact you haven't added the cringe philosophical abstraction "BS", is much appreciated. Many thanks

mrboyban
Автор

I was stuck 3 days about this topic, but this tutorial helps me a lot <3
Very good explanation.

rihanentertainment
Автор

Perfect explanation. Demystified how Python works behind! Thank you for the wonderful video.

colibri-ng
Автор

At 4:29, how does python know the strings in both variables will be equal that they point to same location ? It looks like a = "Programming" and then b = a. In this scenario we create a pointer b pointing to same value as a. But please help me understand why it does the same in first scenario as well ?

rajkaransinghgill
Автор

I would say that there's a caveat to the example @5.48, where 2 strings have the same id.

```
>>> s1 = "this is a sentence"
>>> s2 = "this is a sentence"
>>> id(s1)
4343023216
>>> id(s2)
4343022976
>>> s3 = "could_be_function_name"
>>> s4 = "could_be_function_name"
>>> id(s3)
4343022896
>>> id(s4)
4343022896
>>> s1 is s2
False
>>> s3 is s4
True
```

for the strings s3 and s4 both containing "could_be_function_name", Python applies an optimization called string interning.

Similarly with number from -5 to 255, the id-s are the same, but if you make a variable larger, it will have different id.

aronhegedus
Автор

Хороший видос! 4 года прошло... Поанируешь еще снимать? Было бы классно

sscapture
Автор

Thank you very much. Visualizing such logical terms which physically happens in the background that we can't see with our eyes, helps a lot. Good explanation.!!! fenx:)

raynnaurd
Автор

the variables that are defined (student_grade, student_integer_rep) are constants and should be stored in "DATA" segment of the memory right? HEAP should have dynamic variables afaik.

bharatirajanvss
Автор

Thanks dude, i've been having some issues understanding this topic, however your explication is awesome, now I know how it works !

izaak
Автор

Hello, thanks for this video. I have been trying to get more info about heap and stack memory for Python, do you have some documentation or you just relate to Stack and Heap memory in C?

giopez
Автор

This is very helpful, <3 thanks for the knowledge sharing

ManiacViews
Автор

This video explains it so simply and beautifully. One time i hard i understand wow

LubulaChikwekwe
Автор

it would be very helpful if you drop a link of next video

micro_Dots
Автор

Very well explained, good job. It also worth mentioning that mutability is not transitive, for example: tuple_objoct = (1, [0, 2, 3], "qwe") if I try do this tuple_objoct[1][0] = 'd', what do you think will happen?

AhmadShrif
Автор

and where is the name (word_1 or word_2) stored? As far as i understood, in Stack is stored the address of the value, i.e. the reference to the value. Where is the name of the variable stored? Thanks for the answer!

nononnomonohjghdgdshrsrhsjgd
Автор

There is an error in this video. id return the address for the object in heap or in stack, number = number +1 will not create a new address in stack, just repoint the to the new address in heap.

shengzhibo
Автор

very helpful, many thanks - and good luck with your studies

johnrogers
Автор

Quality video sir, Easily Understable. thank you so much

yathishprogramming