Jython: any workaround for the missing array module

Andreas Ulbrich ulbi at ivs.tu-berlin.de
Wed Jul 24 05:14:36 EDT 2002


Philip Tsai wrote:
> Right; jarray, however, only exposes two methods while the array module
> provides a number of useful methods.
> 
> In my case, I have a (c)python class that manipulates an array of bits using
> array.array('I') structure.  The class uses several array methods such as
> tostring() and fromstring(), which do not seem trivial to re-implement in
> python or jython....  Would you have any suggestion on how to implement such
> array methods (I guss at the end there is always the approach of looking
> into the source code and try to port it...)?

Are the Java-classes in java.util of any help? Especially Arrays, 
ArrayList and so on are worth looking into. They might already provide 
what you are looking for.

Implementing tostring and fromstring is not all that difficult in many 
cases anyway using the string class, list comprehension and so on

Hope that helps.




More information about the Python-list mailing list