K
Kwikrick
When calling str() on a sequence or dict object, the elements of the
sequence/dict will be represented as if their __repr__ method was
called. Why is this? Wouldn't it be more consistent when calling str()
on sequence to use the __str__ method of the elements in the sequence?
As it is now, I often find myself typing something like:
print map(str, alist)
instead of just
print str(alist)
For dicts, it's more eleborate still.
Is there a better way to deal with this?
Rick.
sequence/dict will be represented as if their __repr__ method was
called. Why is this? Wouldn't it be more consistent when calling str()
on sequence to use the __str__ method of the elements in the sequence?
As it is now, I often find myself typing something like:
print map(str, alist)
instead of just
print str(alist)
For dicts, it's more eleborate still.
Is there a better way to deal with this?
Rick.