I would like to create a list-like container class so that, additionally
to usual list methods, I could attach attributes to the container instances.
However, I would like it so that the items contained in the particular
instance of container somehow 'inherit' those attributes i.e.
cont = Containe
Jan Kaliszewski wrote:
[...]
Great! Thanks to all of you for advices and code.
K.
--
http://mail.python.org/mailman/listinfo/python-list
I am writing an application that essentially calculates set of numbers,
say N1, N2, ..., where they can be calculated by several different
algorithms. (One should be able to choose the algorithm at run time.)
In each algorithm one starts from a set of functions, say f1, f2, ...,
which are then t
I am subclassing list class and it basically works, but I don't
understand why after splicing these mylist objects I don't get
returned mylist objects. What I get are list objects:
class mylist(list):
def __init__(self):
list.__init__(self)
k = mylist()
k.append(1)
k.append(2)
k.a
Bearophile wrote:
> Please, can't you just use a bit of functional-style programming? Like
> creating nested functions on the fly, etc.
I thought about it but I believe that in the future some parts of the
code will be reimplemented in C/C++, so I try to keep it simple.
In the end the hint to le
Kreso wrote:
[...]
> I would prefer that resulting object m belonged to myclist class.
I forgot to add that mylist instances in my case have some attributes (that's
why I need special container class in the first place) which should be
preserved after splicing.
In my simple underst