[issue21091] EmailMessage.is_attachment should be a method

Brandon Rhodes report at bugs.python.org
Sat Mar 29 02:26:19 CET 2014


New submission from Brandon Rhodes:

I love properties and think they should be everywhere. But consistency is more important, so I suspect that EmailMessage.is_attachment should be demoted to a normal method. Why? Because if it remains a property then I am likely to first write:

    if msg.is_attachment:
        ...

and then later, when doing another bit of email logic, write:

    if msg.is_multipart:
        ...

Unfortunately this second piece of code will give me no error and will appear to run just fine, because bool(a_method) always returns True without a problem or warning or error. But the result will not be what I expect: the if statement's true block will always run, regardless of whether the message is multipart.

Since EmailMessage is still provisional, and since no one can use is_attachment yet anyway because it is broken for nearly all attachments, mightn't we make these two features consistent before calling it official?

----------
components: email
messages: 215104
nosy: barry, brandon-rhodes, r.david.murray
priority: normal
severity: normal
status: open
title: EmailMessage.is_attachment should be a method
versions: Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21091>
_______________________________________


More information about the Python-bugs-list mailing list