Static Class Initialization Question.

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Fri Jul 4 09:13:24 EDT 2008


On Fri, 04 Jul 2008 14:59:05 +0200, Thomas Troeger wrote:

> Bruno Desthuilliers wrote:
>>> I want to have a list of such classes instantiated automatically on 
> 
> Of course I meant class instances ... sorry :) It's always good to have 
> an example to compensate for English errors *g*.

Well, "class instances" is still a little bit ambiguous in a language
where classes are objects too.  ;-)

> Ah I knew there was something and I couldn't find it in the docs 
> anymore! Now my potential follow-up question is answered as well, namely 
> how I can instantiate with variable argument lists, like this:
> 
>  >>> bla = [A(*args) for args in ((), (1,), (1, 2))]
>  >>> map(str, bla)
> ['A(0,1)', 'A(1,1)', 'A(1,2)']

Looks like you want default values for the arguments of `A.__init__()`.

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list