Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

oops python self and making an object of a class and calling function

class A:
    def a(self,st):
        return 1
            
    def b(self,s1,s2) :
        d= self.a(7)
        return d    
obj=A()
print(obj.b(1,2))
//prints 1
// so basically every function in a class have self which is object
// like in each of them self is there -- def a(self,st): & def b(self,s1,s2):
// used to other functions of that class and 
//it's used to call other functions & while calling that other function
// we don't write self inside it
// d= self.a(7)
Comment

PREVIOUS NEXT
Code Example
Python :: python Parse string into integer 
Python :: split dataframe row on delimiter python 
Python :: scapy python functions 
Python :: pass in python 
Python :: pk django 
Python :: python string 
Python :: python double underscore methods 
Python :: how to make loop python 
Python :: django form date picker 
Python :: what is thread in python 
Python :: //= python meaning 
Python :: Tree recursive function 
Python :: django cache framework 
Python :: indefinite loops python 
Python :: python child class init 
Python :: asyncioevents.py", line 504, in add_reader raise NotImplementedError 
Python :: django model make the field caseinsensitive 
Python :: supercharged python 
Python :: what is a rare earth 
Python :: how to make a window in python ursina 
Python :: how to add the number to email address in faker library in python? 
Python :: biggest number 
Python :: #finding the similarity among two sets and 1 if statement 
Python :: Make Latest pyhton as default in mac 
Python :: pip_install_packages2.bat 
Python :: separate alphanumeric list 
Python :: def LinearSearch(array, n, k): 
Python :: 10.4.1.3. return Terminates Function Execution 
Python :: how to convert array of arrays into single array with unique values in numpy 
Python :: alan watts 
ADD CONTENT
Topic
Content
Source link
Name
5+4 =