I wonder if this bug should be reopened. This behavior does not seem right to me:
parsing 'merwok'
expected ('merwok', '')
got ('', 'merwok')
parsing 'merwok wok@rusty'
expected ('', 'wok@rusty')
got ('', 'merwokwok@rusty')
(Generated with a twenty-line script just doing a loop and prints, not attached because boring.)
Are my expectations wrong? I don’t know if a string like “merwok” in my first example is a legal address in the relevant RFCs, nor do I know if the folding done in the second example is okay.
For background, the thing I’m trying to achieve is to take a string and parse it into name and email address, and print a warning if there is no email. It’d be nice if I could always test for “not parseaddr(s)[1]”, or pass an argument to the function to get an exception. Maybe I’ll have to restrict my format and do my own parsing with str.[r]partition. |