def parse_method_descriptor(descr, name=None):
 assert (descr and (descr[0] == '('))
 descr = descr[1:]
 params_list = []
 while (descr[0] != ')'):
  (param, descr) = eat_descriptor(descr)
  params_list.append(param)
 (type, tail) = eat_descriptor(descr[1:])
 assert (not tail)
 params = ', '.join(params_list)
 if name:
  return ('%s %s(%s)' % (type, name, params))
 else:
  return ('%s (%s)' % (type, params))

def parse_method_descriptor ( descr , name = None ) : assert ( descr and ( descr [ 0 ] == '(' ) ) descr = descr [ 1 : ] params_list = [ ] while ( descr [ 0 ] != ')' ) : ( param , descr ) = eat_descriptor ( descr ) params_list . append ( param ) ( type , tail ) = eat_descriptor ( descr [ 1 : ] ) assert ( not tail ) params = ', ' . join ( params_list ) if name : return ( '%s %s(%s)' % ( type , name , params ) ) else : return ( '%s (%s)' % ( type , params ) )
parse a method descriptor .