[pygtk] two constructors for same object

varun_shrivastava shrivastavavarun at yahoo.co.in
Fri Jun 29 16:55:51 WST 2007

i have 2 constructors one with no arguments and the other with arguments

so do i need to wrap them individually or i can have only one wrapper
which takes optional arguments.

for eg

1st constructor:  add_num_new()
2nd Constructor add_num_new_with_numbers(int a, int b)

now i can override it as 

_wrap_add_num_new args (..........)
       int i = 0;
       int j = 0;
       PyArg_ParseTuple(args,"|ii:AddNum.new", &i, &j);

       if(i==0 &&j==0)
                 self->obj = add_num_new();
                  self->obj = add_num_new_with_numbers(i,j);
       pygobject_register_wrapper((PyObject *)self);
       return 0;

and also to add a line as

is it fine or not

View this message in context: http://www.nabble.com/two-constructors-for-same-object-tf3998849.html#a11356998
Sent from the Gtk+ - Python mailing list archive at Nabble.com.

More information about the pygtk mailing list