RUVIDEO
Поделитесь видео 🙏

aliasing vs cloning in python смотреть онлайн

📁 Обучение 👁️ 16 📅 03.12.2023

In this video you will learn about aliasing and cloning of objects in python.

alias in python
Assignment operator in python do not create copies of objects, instead they only bind a new name to an existing object. The new name is called the alias and this process is called the aliasing. The object and its alias have the same memory address/reference. Consider the following example:
x=[10,20,30]
Here x is a list.

y=x, adds the name y, to the same location which is represented by x.


So if we change : y[0]=100, then x[0] is also changed as, x and y are only two different names, representing the same object in memory.


If we print x[0] or y[0] both will print the 100.
If we compare x and y using == it gives true as both have same values, if we compare them using is operator it also gives True because both x and y are same objects.
Note: Here problem is that both x and y referring to same objects, so if we make change in one other is also altered. If we do not want to change the original list when we change new list then we use concept of cloning.

Cloning in python
The cloning of list can be achieved using the copy() function or using the list slicing. Consider the following example:
x=[10,20,30]
Here x is a list.

y=x.copy(), creates a new instance, having same values as x, but x and y points to two different objects in the memory.


So if we change : y[0]=100, x is not affected.


If we compare x and y using == it gives true as both have same values, if we compare them using is operator it gives False because both x and y are not same objects.

#python_by_tarun_sir #tarun_sir #python #tarun_sir_python #python_video_71 #aliasing_in_python #python_tutorial #cloning_in_python

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «aliasing vs cloning in python» бесплатно и без регистрации, вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.