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

Discussion in 'Python' started by Stef Mientki, Mar 28, 2008.

  1. Stef Mientki

    Stef Mientki Guest

    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)
    >
    >
    >
     
    Stef Mientki, Mar 28, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ilias Lazaridis
    Replies:
    6
    Views:
    461
    Ilias Lazaridis
    Feb 21, 2006
  2. james_027
    Replies:
    1
    Views:
    346
    Marc 'BlackJack' Rintsch
    Aug 22, 2007
  3. Stef Mientki

    class or inherited list ?

    Stef Mientki, Mar 28, 2008, in forum: Python
    Replies:
    0
    Views:
    241
    Stef Mientki
    Mar 28, 2008
  4. Navkirat Singh
    Replies:
    6
    Views:
    3,249
    Navkirat Singh
    Jul 29, 2010
  5. 7stud --
    Replies:
    11
    Views:
    441
    7stud --
    Nov 9, 2007
Loading...

Share This Page