Touch sensor in Python

If I add a Touch sensor, is there code to reference it in Python? I want to try playing around with a few things in mind, but don’t know how to call it. I mean, is there something simple like an onTouch() function, or what’s the best way to approach this without logic bricks? Thanks for any help ya’ll can offer.

The problem with Python, is very few things can be done with out using logic bricks in some fashion. One such thing is the touch sensor. You can do stuff with an attached touch sensor:

cont = GameLogic.getCurrentController()

#Where touch is the name of the attached touch sensor...
touch = cont.getSensor("touch")

#Then you can do stuff with the touch sensor...

Here are some things you can do with a touch sensor and Python:

Other than that, you can fake a touch sensor by using getDistanceTo(), but this would act closer to a near sensor.