Error in the email module documentation ?

Terry Reedy tjreedy at udel.edu
Fri Oct 3 09:57:44 EDT 2003


"Adrien Di Mascio" <Adrien.DiMascio at logilab.fr> wrote in message
news:mailman.1065165607.18026.python-list at python.org...
> Hi all,
>
> While reading the email module documentation, I found an error in a
> small example given for the as_string() method of the Message class:
> Here is the given code :
>
>    (URL :
http://python.org/doc/current/lib/module-email.Message.html)
>
>    from cStringIO import StringIO
>    from email.Generator import Generator
>    fp = StringIO()
>    g = Generator(mangle_from_=False, maxheaderlen=60)
>    g.flatten(msg)
>    text = fp.getvalue()
>
>
> The Generator constructor should take the StingIO instance as first
> argument

Based on 12.2.3 Generating MIME documents:'''
class Generator( outfp[, mangle_from_[, maxheaderlen]])
The constructor for the Generator class takes a file-like object
called outfp for an argument. outfp must support the write() method
and be usable as the output file in a Python extended print statement.
''',
yes.

> am I wrong ?

No

> Although this is only a small mistake, I think it should always
> be fixed.

Of course, Python docs strive for perfection.  I did not find report
in Python/Doc bugs list so added to SourceForge as bug 817178
Email.message example missing arg

Terry J. Reedy






More information about the Python-list mailing list