From: Kevin B. <kb...@ca...> - 2001-06-22 19:58:04
|
Just looked a little more closely at your Java code, and I think what you probably wanted to write was: import time ## from wherever import ArrayBenchmark test = ArrayBenchmark() test.setLength( arraySize ) totalTime = test.repeat( count ) print "Array Benchmark: %(count)d iterations in %(totalTime)d milliseconds" % vars() No sense writing more Java than you have to. <.5 wink> kb "W. Jarrett Campbell" wrote: > Hello. I've been using Python for a short while and one of my > developers is insisting he'd prefer to supply me with Java classes > rather than C++ classes so I'm contemplating making the jump to > Jython.We were running a simple benchmark test to see if we could this > system working for us and I've encountered a few problems. Could > someone here give me a few pointers?I'm trying to execute the > following method in Jython: public static void main(String[] args) { > try { > int count = Integer.parseInt(args[0]); > int arraySize = Integer.parseInt(args[1]); > ArrayBenchmark test = new ArrayBenchmark(); > test.setLength( arraySize ); > > long totalTime = test.repeat(count); > System.out.println("Array Benchmark: " + count + " iteration(s) > in " + totalTime + " milliseconds"); > } catch (Exception e) { > System.out.println("Exception: " + e); > e.printStackTrace(); > } > } > Every time I execute this command, I get a message that the String > coercion is failing. Any ideas?>>> > com.ydyn.dynamo.test.ArrayBenchmark.main('10 100') > Traceback (innermost last): > File "<console>", line 1, in ? > TypeError: main(): 1st arg can't be coerced to String[] > >>> > > [Image] W. Jarrett Campbell, Ph.D. 512.323.9149 Member of the office Technical Staff 512.257.9503 fax Yield Dynamics, 512.415.1078 Inc. mobile 5838 Balcones ja...@yd... Drive, Ste. 101 http://www.ydyn.com Austin, TX 78731 > |