Class or dictionary ? (was: class or inherited list ?)

Stef Mientki stef.mientki at gmail.com
Fri Mar 28 17:48:05 EDT 2008


Sorry,
although the code example was correct,
the question was wrong.

Stef Mientki

Stef Mientki wrote:
> hello,
>
> Passing all kinds of data between objects,
> I'm looking for an elegant (and simple) way to pack the data.
> Now it looks to me that both the class and the inherited list,
> performs equally well.
> Till now, the most elegant way (in my view) is the list inheritance,
> mainly because you don't need brackets and no quotes.
> What are others opinion about this ?
>
> thanks,
> Stef Mientki
>
> class super_list(list):
>    pass
>
> def kwadraat ( value ) :
>    return value * value
>
> x={}
> x['frequency']=33
> x['functie']=kwadraat
> print x['functie'](2)
>
> y = super_list()
> y.frequency = 33
> y.functie = kwadraat
> print y.functie(3)
>
>
>




More information about the Python-list mailing list