what is payload

Frank Millman frank at chagford.com
Thu Sep 7 04:09:17 EDT 2017


"Andrej Viktorovich"  wrote in message 
news:4ad4fa0e-cd61-412d-8c8f-9f5be2bad3db at googlegroups.com...
>
> Hello,
>
> Have working sample with strange property - payload:
>
> class ExampleClass(object):
>     def __init__(self,value):
>         print("Initialising instance...")
>         self.payload = value
>
> exampleInstance = ExampleClass(42)
> print(exampleInstance.payload)
>
> Is it some default field that all objects has? What it is used for?
>

It is not a default field. It is explicitly created in the line 
'self.payload = value'

I think they are trying to show you that when you create your own class, you 
can give it any attributes you like, and call them whatever you like.

If you changed 'payload' in the above to 'xyz', it would work exactly the 
same.

Frank Millman






More information about the Python-list mailing list