How to get get_body() to work? (about email)

Jon Ribbens jon+usenet at unequivocal.eu
Mon Mar 20 08:41:57 EDT 2023


On 2023-03-19, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> On 20/03/23 7:07 am, Jon Ribbens wrote:
>> Ah, apparently it got removed in Python 3, which is a bit odd as the
>> last I heard it was added in Python 2.2 in order to achieve consistency
>> with other types.
>
> As far as I remember, the file type came into existence
> with type/class unification, and "open" became an alias
> for the file type, so you could use open() and file()
> interchangeably.
>
> With the Unicode revolution in Python 3, file handling got
> a lot more complicated. Rather than a single file type,
> there are now a bunch of classes that handle low-level I/O,
> encoding/decoding, etc, and open() is a function again
> that builds the appropriate combination of underlying
> objects.

This is true, however there does exist a base class which, according to
the documentation, underlies all of the different IO classes - IOBase -
so it might have been neater to make 'file' be an alias for that.


More information about the Python-list mailing list