How do you know when to use a function by wraping the content between parentheses "function(x) or through dot notation x.function()
? thanks.
lewashby
56
Junior Poster
Recommended Answers
Jump to PostHow do you know when to use a function by wraping the content between parentheses "function(x) or through dot notation x.function()
? thanks.You are somewhat confused about functions.
Jump to PostThink maybe you are confused about calling a function and calling a method.
def my_func(name, greeting = 'Hello'): print '%s, %s' % (greeting, name) #Call a function my_func('tom') #output <Hello tom> #-----------------------------------# class myClass(object): # Inside a class this is called a method def my_method(self,name,greeting = 'Hello'): …
All 6 Replies
sneekula
969
Nearly a Posting Maven
vegaseat
1,735
DaniWeb's Hypocrite
Team Colleague
snippsat
661
Master Poster
masterofpuppets
snippsat
661
Master Poster
masterofpuppets
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.