--
You received this message because you are subscribed to the Google Groups "thespian.py" group.
To unsubscribe from this group and stop receiving emails from it, send an email to thespianpy+...@googlegroups.com.
To post to this group, send email to thesp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/thespianpy/2adb6056-7145-4dbc-a92f-e652c8e18f9b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
class Typer(ActorTypeDispatcher):
def receiveMsg_str(self, message, sender): self.send(sender, "Got a string")
def receiveMsg_int(self, message, sender): self.send(sender, "Got an int")--
You received this message because you are subscribed to the Google Groups "thespian.py" group.
To unsubscribe from this group and stop receiving emails from it, send an email to thespianpy+...@googlegroups.com.
To post to this group, send email to thesp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/thespianpy/c70af328-0c78-4d7f-bfb8-5c7f86274603%40googlegroups.com.
The general method you are using is the one I would recommend: using an initial setup message. It is not possible to pass arguments to the init because that init might be done in another process, so the arguments would essentially become a message to that process anyhow.
If the values seem to be available at init time it should be ok to use them, but I would not usually expect this to be the case.
There is a decorator that can help you write actors that need these types of initialization messages: see thespian/initmsgs.py for more details.
Two small notes about the code you posted:1. I would recommend using the customary pattern of "def __init__(*args, **kw)" and then "super(...).__init__(*args, **kw)". There are currently no positional or keyword arguments for the base class, but using the pattern will future proof in the event that some are added in a subsequent release. (You should not need to worry about the __init__ if you use the decorator above)
2. It looks like the shopify.ShopifyResource is global. Be careful because if you call self.createActor it will sometimes create the new actor by cloning the current actor's process, which would cause the new actor process to inherit the credentials of the creating actor.
I you're open to unsolicited advice, I would recommend using the ActorTypeDispatcher as in
--
You received this message because you are subscribed to the Google Groups "thespian.py" group.
To unsubscribe from this group and stop receiving emails from it, send an email to thespianpy+...@googlegroups.com.
To post to this group, send email to thesp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/thespianpy/8ad94ca6-e2f5-417c-92bd-df5a9150eedc%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "thespian.py" group.
To unsubscribe from this group and stop receiving emails from it, send an email to thespianpy+...@googlegroups.com.
To post to this group, send email to thesp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/thespianpy/a05ad40e-eb47-4db4-b994-e6339e7d018a%40googlegroups.com.