Closed davideps closed 4 years ago
What you have is fine (although I recommend standard python convention of adding *args, **kw
to the __init__
signature and passing those to the base class initializer as in super().__init__(*args, **kw)
.
The Actor __init__()
cannot perform any actor-related operations (e.g. calling self.send()
) and as with the issue you referenced, it should defer initialization requiring external interactions or information to be handled by a received message instead.
Thank you for the quick reply. I'll send values for initialization via a message, probably a dictionary.
On Thu, Feb 13, 2020, 5:37 PM Kevin Quick notifications@github.com wrote:
What you have is fine (although I recommend standard python convention of adding *args, *kw to the init signature and passing those to the base class initializer as in super().init(args, **kw).
The Actor init() cannot perform any actor-related operations (e.g. calling self.send()) and as with the issue you referenced, it should defer initialization requiring external interactions or information to be handled by a received message instead.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kquick/Thespian/issues/56?email_source=notifications&email_token=AANTN7LVYXFQ5GDCEZTSODDRCVSKFA5CNFSM4KUUIV4KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELVOMTA#issuecomment-585819724, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANTN7LVQZJ3ZJAZNK62DDLRCVSKFANCNFSM4KUUIV4A .
You're welcome, and please feel free to re-open this issue if you have further difficulties or questions.
Might be my python knowledge, but I get an error with the following
class DateGroupActor(ActorTypeDispatcher):
def __init__(self, *args, **kw):
super().__init__(*args, **kw)
self.seat_percent = self.createActor(SeatPercentage)
AttributeError: 'DateGroupActor' object has no attribute '_myRef'
I have also tried putting the self. attribute assignment before calling super, no difference. as far as I can tell, Ive followed the above suggestion, any idea what is wrong?
I found this issue from a few years ago: https://github.com/thespianpy/Thespian/issues/18 but I don't think it fits my case. How would I initialize a simple actor with its own id number and perhaps other state variables like: