Is it possible to define a function with more than one set amount of parameters in Python? -


this question has answer here:

i define function takes 2 arguments, possibility of third. i'm isn't possible, considering built-in range function has:

range(stop) -> range object range(start, stop[, step]) -> range object 

maybe it's possible? or maybe have wrong idea because range immutable sequence type?

for clarity's sake, same function example(x,y) run example(x,y,z)

def example(x, y, z=none):     if z none:         return x + y     else:         return x + y + z 

then

>>> example(3, 4) 7  >>> example(3, 4, 5) 12 

Comments

Popular posts from this blog

SVG stroke-linecap doesn't work for circles in Firefox? -

routes - Laravel 4 Wildcard Routing to Different Controllers -

cross browser - XSLT namespace-alias Not Working in Firefox or Chrome -