As a side-note, unless you're okay with only being able to access those 
instance variables through the fields list (ie fields[0], fields[1], 
fields[2]), you may want to actually name them first.

Jan Eden wrote:

>Hi,
>
>Jan Eden wrote on 20.09.2005:
>
>  
>
>>Hi,
>>
>>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?
>
>TIA,
>
>Jan
>  
>


-- 
Email: singingxduck AT gmail DOT com
AIM: singingxduck
Programming Python for the fun of it.

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to