# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: 'Python 3.8.1 64-bit (''pyUdemy'': conda)'
#     name: python38164bitpyudemyconda8c705f49a8e643418ce4b1ca64c8ab63
# ---

def print_memory_address(var):
    print(hex(id(var)))


my_test_value = 10 # int(10)
print_memory_address(my_test_value)

# +
my_int_value1 = 42
my_int_value2 = 42
my_int_value3 = 42

print_memory_address(my_int_value1)
print_memory_address(my_int_value2)
print_memory_address(my_int_value3)

# +
my_float_value1 = 42.0
my_float_value2 = 42.0
my_float_value3 = 42.0

print_memory_address(my_float_value1)
print_memory_address(my_float_value2)
print_memory_address(my_float_value3)

# +
my_bool1 = True
my_bool2 = True

print_memory_address(my_bool1)
print_memory_address(my_bool2)

# +
my_bool1 = False
my_bool2 = False

print_memory_address(my_bool1)
print_memory_address(my_bool2)

# +
my_none1 = None
my_none2 = None

print_memory_address(my_none1)
print_memory_address(my_none2)

# +
my_list1 = [1, 2, 3]
my_list2 = my_list1

print(my_list1)
print(my_list2)

print_memory_address(my_list1)
print_memory_address(my_list2)

my_list1 = [-1, -2, -3]

print_memory_address(my_list1)
print_memory_address(my_list2)

# +
a = 10
b = 10

print_memory_address(a)
print_memory_address(b)
print()

b = 8

print_memory_address(a)
print_memory_address(b)
print()

b = 10

print_memory_address(a)
print_memory_address(b)
print()

a = 8
b = 9

print_memory_address(a)
print_memory_address(b)
print()

a = 10
b = 10

print_memory_address(a)
print_memory_address(b)
print()

# +
import ctypes

my_list1 = [1, 2, 3]
my_list2 = my_list1
my_list3 = my_list1

print(ctypes.c_long.from_address(id(my_list1)))

StarcoderdataJupyterScriptsDedupFiltered