Hello, loves! I’ve made a notable change to PubSub, with more to come. Keyword arguments. Small apology for poor testing. I’ve noticed that when setting up callbacks with PubSub, I often get the parameters wrong. A note on a card here says “Checking for PubSub parameters”, and I decided to take a cut at that. After a bit of exploring and printing, I began, in several steps, to change over to keyword arguments. As things stand now, here is how one publishes an event: def interact_with_player(self, dungeon) -> bool: self.state = (self.state+1)%len(self.resources) dungeon.publish('state_number', self.name, content=self, state=self.state) return self.enterable You now provide the parameters beyond the event and caller_id with keywords. (Possibly we should require the other two as well: I’ve not decided yet.) My tentative plan is that when one defines a new PubSub message, the done thing will be to add an entry to a structure in the PubSub object that includes the event name and the…
No comments yet. Log in to reply on the Fediverse. Comments will appear here.