[Twisted-Python] naming conversational methods
acapnotic at twistedmatrix.com
Wed Oct 10 15:48:30 EDT 2001
Generally in an object model, if I'm an object, my methods are things I
do. If someone says kevin.run(), I run. If they say kevin.jump(height),
I jump, and if they say kevin.watch(), I keep my eyes open.
But if a perspective is addressing me me through a viewpoint, how should
my methods which act upon her be named? If she says to herself, "Self,
listen to Kevin," that seems natural to write as self.listen(kevin).
Except, in order for her to listen to me, she needs to have me add her
to my list of my audience members. So how does her listen method
Not as kevin.listen(), because she's the one listening, not me.
kevin.speak()? No, she's not commanding me to speak, she just wants to
know in the event that I do. kevin.speakTo() seems odd without an
object. Someone else could say kevin.speakTo(her), but what she really
means is kevin.speakToMe().
Does that work?
def view_speakToMe(self, perspective):
"""I will now speak to she who invoked this method."""
# Does it make sense that the personal pronoun in "speakToMe"
# refers not to *me*, but to the perspective's owner?
# Or does a passive phrasing make more sense?
def view_beListenedTo(self, perspective):
"""This perspective will be listening to me."""
Kevin Turner <acapnotic at twistedmatrix.com> | OpenPGP encryption welcome here
The moon is waning cresent, 46.0% illuminated, 22.5 days old.
More information about the Twisted-Python