Python pointer

Asked 2 years ago, Updated 2 years ago, 59 views

Hello.

p = None
if b.x == c.x:
    //

When Python has the following code, make the variable p a pointer for readability and externally I'd like to use corb Like this.

*p = None #virtual grammar
if ...:
    p = &c #Virtual Grammar

What should I do?

pointer python reference

2022-09-20 16:57

2 Answers

If you look at the text... I don't know if I should use C's pointer grammar. I don't know, but...

class object():
    def __init__(self, param):
        self.x = param

p = None
a = object(4) 
b = object(4) 

print(a) #<__main__.object object at 0x03975AD8>
print(b) #<__main__.object object at 0x03BF5148>

if(a.x == b.x)x):
    p = a

print(p) #<__main__.object object at 0x03975AD8>
p.x = 5

print(a.x) # 5


2022-09-20 16:57

No matter how much you want to have sex, you can't have sex with Python.

Let's not overdo what we can't do. Python is having a hard time.


2022-09-20 16:57

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.