title: Routing to method based on string
body: <p>I'm trying to call a method based on a string in Python similar to the way Tornado routes requests based on the URL. So for example, if I had the string "/hello" I want to call the method "hello" in some class. I've been looking at Python Routes and came up the following solution:</p>
  
  <pre><code>from routes import Mapper
  
  class Test():
      def hello(self):
          print "hello world"
  
  map = Mapper()
  map.connect(None, '/hello', controller=Test(), action='hello')
  
  match = map.match("/hello")
  if match != None:
      getattr(match['controller'], match['action'])()
  </code></pre>
  
  <p>However I would like to add the ability to pass parts of the string as arguments to the method. So for example, with the string "hello/5" I want to call <code>hello(5)</code> (again very similar to Tornado's routing). This should work for an arbitrary number of arguments. Does anyone have a good approach to this? Would it be possible to use Tornado's routing capabilities on a string that is not the request URL? </p>