-j
-j
def sayHey(name="You"):
print('Hey, {0}'.format(name))
sayHey() # Hey, You
sayHey('John') # Hey, John
func sayHey(name string) string {
if name == "" {
name = "You"
}
fmt.Sprintf("Hey, %s", name)
}
func sayHey(args ...string) string {
name := "You"
if len(args) > 0 {
name = args[0]
}
return fmt.Sprintf("Hey, %s", name)
}
:)) ok let me show you in the following example:
def sayHey(name="You"):
print('Hey, {0}'.format(name))
sayHey() # Hey, You
sayHey('John') # Hey, John
Your opinion is like to say all of the python application should rethink and re-write their structure because they used default values.
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
x.M
, there's only ever one M
associated with x
. Again, this makes it easy to identify which method is referred to given only the name. It also makes the implementation of method invocation simple.