Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

self object

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 :: Creating lambda expressions in comprehension list 
Python :: dot product of lists 
Python :: create and add many to many field in django 
Python :: python function arguments 
Python :: queue class python 
Python :: flask page 
Python :: python code to add element in list 
Python :: how to install python 
Python :: how to read a file in python 
Python :: python fetch 
Python :: how to change datatype of column in pandas 
Python :: what is scaling 
Python :: get number of row dataframe pandas 
Python :: python array empty 
Python :: get center position of countries geopandas 
Python :: sum two linked lists if numbers are reversed in linked list 
Python :: Python OrderedDict - LRU 
Python :: eastvale roblox python 
Python :: python. printing varibles 
Python :: arcpy line density 
Python :: rscript convert r to python script 
Python :: openCV error [WARN:0] terminating async callback 
Python :: groupby sum and mean 2 columns 
Python :: remove color from shapefile python 
Python :: pie chart labeling 
Python :: print all data in excel openpyxl 
Python :: import 
Python :: dickyfuller test in python 
Python :: set colour to inserplaintext qtextedit in python 
Python :: pandas read csv skip until expression found 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =