[Tutor] List of class instances

Jan Eden lists at janeden.org
Tue Sep 20 11:39:02 CEST 2005


Jan Eden wrote on 20.09.2005:

>I'd like to form a list of class instances. The following does not work 
>(TextfieldLong, Textarea, TextfieldShort etc being class names):
>    fields = [
>        TextfieldLong(name='title', label='Seitentitel', value=''),
>        Textarea(name='content', label='Inhalt', value=''),
>        ShortField(name='mother_id', label='MotherID', value=1)
>    ]

Just found that it *does* work, but that I have to define the classes above the list assignment. Why is that? Why would Python not find the classes within the same file?


Life's unfair - but root password helps!

More information about the Tutor mailing list