OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Can we declare instance variable of a class inside a member function in Python class [duplicate]

  • Thread starter Thread starter Arun Agarwal
  • Start date Start date
A

Arun Agarwal

Guest
Suppose I have a class

Code:
class SelfCheck:
    def __init__(self,data):
        self.insideData = data
    def setData(self,data):
        self.insidesetData = data
    def getData(self):
        print("Inside init:",self.insideData,"Inside Set Data :",self.insidesetData)

My concern is self.insidesetData is a instance variable or something else ,please do clear the concept with example
<p>Suppose I have a class</p>
<pre><code>class SelfCheck:
def __init__(self,data):
self.insideData = data
def setData(self,data):
self.insidesetData = data
def getData(self):
print("Inside init:",self.insideData,"Inside Set Data :",self.insidesetData)
</code></pre>
<p>My concern is <code>self.insidesetData</code> is a instance variable or something else ,please do clear the concept with example</p>
 

Latest posts

Online statistics

Members online
0
Guests online
6
Total visitors
6
Top