R
Roman Suzi
I was playing with email package and discovrered this strange kind of
behaviour:
....
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/local/lib/python2.3/email/Message.py", line 304, in __getitem__
return self.get(name)
File "/usr/local/lib/python2.3/email/Message.py", line 370, in get
name = name.lower()
AttributeError: 'int' object has no attribute 'lower'
I think that if any object (from standard library at least) doesn't support
iteration, it should clearly state so.
My guess is that 'for' causes the use of 'm[0]', which is (rightfully) an
error...
Can this behaviour of email be considered a bug?
Is there a good case to iterate over something useful in a message?
P.S. rfc822 has the same behaviour, at least on Python 2.3
Sincerely yours, Roman Suzi
behaviour:
a: 123From nobody Mon Feb 21 00:12:27 2005import email.Message
m = email.Message.Message()
m['a'] = '123'
print m
....
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/local/lib/python2.3/email/Message.py", line 304, in __getitem__
return self.get(name)
File "/usr/local/lib/python2.3/email/Message.py", line 370, in get
name = name.lower()
AttributeError: 'int' object has no attribute 'lower'
I think that if any object (from standard library at least) doesn't support
iteration, it should clearly state so.
My guess is that 'for' causes the use of 'm[0]', which is (rightfully) an
error...
Can this behaviour of email be considered a bug?
Is there a good case to iterate over something useful in a message?
P.S. rfc822 has the same behaviour, at least on Python 2.3
Sincerely yours, Roman Suzi