optional arguments

Silvio Arcangeli sarcangeli at montrouge.sema.slb.com
Mon Sep 17 05:38:01 EDT 2001


Hello everybody,
sorry for this question that may seem silly.
I have an object whose __init__  looks like the following:

class Connection:
	def __init__(self, ip=def_ip, port=def_port)
		...

I have to call two different functions when the object is instantied like
c=Connection()
and when it is instantiated like
c=Connection(def_ip, def_port)

how can I tell wheter no arguments were passed from the user or whether 
they were passed but they were just like the default values?

Silvio.





More information about the Python-list mailing list