I know conj(x) and x.conj() do the same thing, but what is the main difference?. Is that we can do any function as method such as sum(x) written as x.sum()?
            Asked
            
        
        
            Active
            
        
            Viewed 115 times
        
    1 Answers
1
            If you are creating your own class you can define a method to use the built in function:
class Example(list):
    def sum(self):
        return sum(self)
x = Example((1,2,3))
print(x.sum())
Although there is no direct way to make this functionality available to built in types like list itself.
 
    
    
        Tadhg McDonald-Jensen
        
- 20,699
- 5
- 35
- 59
 
    