>>>>> Chris Rebert <c...@rebertia.com> (CR) wrote: >CR> On Wed, May 6, 2009 at 5:24 AM, Piet van Oostrum <p...@cs.uu.nl> wrote: >>>>>>>> Lacrima <lacrima.ma...@gmail.com> (L) wrote:
>L> But what if I have to instantiate any class with 3 or 4 required >L> arguments? How can I do it? >>> >>> cls.__init__.im_func.__code__.co_argcount >>> >>> This will include self, so it will be 1 in First and 2 in Second. >CR> AFAICT, that would count non-required arguments too, which isn't >CR> strictly what the OP requested. If you mean, parameters with default values, yes. Of course you can find out how many of these there are from cls.__init__.func_defaults, but this will get dirtier and dirtier. -- Piet van Oostrum <p...@cs.uu.nl> URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4] Private email: p...@vanoostrum.org -- http://mail.python.org/mailman/listinfo/python-list