[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

what is payload

"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 

Frank Millman