[issue14977] mailcap does not respect precedence in the presence of wildcards

Michael Lazar report at bugs.python.org
Tue Jul 12 21:22:14 EDT 2016


Michael Lazar added the comment:

I can certainly do that. Although in addition to adding a keyword argument, we would also have to change the return signature to switch between modes like this:

    if lineno is None:
        return caps
    else:
        return caps, lineno

Overall I'm not a fan of this technique and would like to avoid it if possible. The problem is that we have to keep track of the current line between successive calls to readmailcapfile(). An alternative would be to go back to using lineno as a generator. This is close to what I had in the initial patch.

    lineno = itertools.count()
    caps = readmailcapfile(fp, lineno=lineno)
    caps = readmailcapfile(fp2, lineno=lineno)
    caps = readmailcapfile(fp3, lineno=lineno)
    ...etc

Happy to hear any insights you have on this.

----------

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


More information about the Python-bugs-list mailing list