From: Martin Quinson Date: Wed, 9 Jan 2019 09:39:28 +0000 (+0100) Subject: more pythonic example X-Git-Tag: v3_22~630 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/1fa3f778c3669d0658cf13b6da1a5c35b452a678?hp=1e74025225ff652603a0ad05f88e451f58cb6157 more pythonic example --- diff --git a/examples/python/actor-create/actor-create.py b/examples/python/actor-create/actor-create.py index c8719b7293..3bd71d56f1 100644 --- a/examples/python/actor-create/actor-create.py +++ b/examples/python/actor-create/actor-create.py @@ -58,17 +58,10 @@ class Sender: Later, this actor class is instantiated twice in the simulation. """ - mbox = "mb42" - msg = "GaBuZoMeu" - - def __init__(self, *args): - if len(args) > 0: - self.msg = args[0] - if len(args) > 1: - self.mbox = args[1] - if len(args) > 2: - raise AssertionError( - "Actor sender requires 2 parameters, but got only {:d}".format(len(args))) + + def __init__(self, msg = "GaBuZoMeu", mbox = "mb42"): + self.msg = msg + self.mbox = mbox def __call__(self): this_actor.info("Hello s4u, I have something to send")