Is this mailbox manipulation working by luck, or can't I understand my own code?

Thomas Jollans tjol at tjol.eu
Sat Oct 13 12:44:49 EDT 2018


On 13/10/2018 18:28, Chris Green wrote:
> Stefan Ram <ram at zedat.fu-berlin.de> wrote:
>> Chris Green <cl at isbd.net> writes:
>>> msg.get
>>
>>    You can get some information about »get«:
>>
>> print( "msg.get.__doc__ =", msg.get.__doc__ )
>> print( "msg.get.__func__ =", msg.get.__func__ )
>> print( "msg.get.__self__ =", msg.get.__self__ )
>> print( "msg.get.__str__() =", msg.get.__str__() )
>> print( "msg.get.__repr__() =", msg.get.__repr__() )
>> print( "msg.get.__name__ =", msg.get.__name__ )
>> import dis
>> dis.dis( msg.get )
>> dis.show_code( msg.get )
>>
> Thanks, yes, this tells me a little:-
> 
>      ('msg.get.__doc__ =', 'Get a header value.\n\n        Like
>      __getitem__() but return failobj instead of None when the field\n
>       is missing.\n        ')
> 
> However it isn't mentioned *anywhere* in the documentation that I can
> see.  There's only __getitem__() and get() for the mailbox class which
> operate on a whole mailbox and return a whole message.`
> 

https://docs.python.org/3.7/library/mailbox.html#message-objects does 
say that all the different message types are subclasses of 
email.message.Message.

... and these are the docs you're looking for:

https://docs.python.org/3.7/library/email.compat32-message.html#email.message.Message.get



More information about the Python-list mailing list