Bruno Desthuilliers wrote:

> FWIW, I guess that what you want here may looks like this:
>
> class Word(object):
>    def __init__(self, word=''):
>      self._word = word
>    def __repr__(self):
>      return "<Word %s at %d>" % (self._word, id(self))
>
>
> words = []
> for w in ['this', 'is', 'probably', 'what', 'you', 'want']:
>    words.append(Word(w))
> print words

Or more compactly:

words = [Word(w) for w in 'this is probably what you want'.split()]
print words

George

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to