Re: [Tutor] delphi, pascal and Python

2009-06-03 Thread Andy Cheesman
By the way, the error was generated by following the tutorial and compiling in lazarus After Much Looking and pointers from the author, There is this most excellent post by the same author at http://wiki.lazarus.freepascal.org/Developing_Python_Modules_with_Pascal This nearly works but I

Re: [Tutor] delphi, pascal and Python

2009-06-02 Thread Andy Cheesman
After Much Looking and pointers from the author, There is this most excellent post by the same author at http://wiki.lazarus.freepascal.org/Developing_Python_Modules_with_Pascal This nearly works but I have issue with the linking of the new module. The error is Linking PyMinMod.so /usr/bin/ld:

[Tutor] delphi, pascal and Python

2009-05-20 Thread Andy Cheesman
Hi people Is there a Method for wrapping delphi and/or pascal code into python like SWIG? I've googled to no avail, Can anyone help me? Andy ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] replacing range with xrange

2008-01-28 Thread Andy Cheesman
Hi people, After watching a nice Google video on Python 3K, and seeing the forthcoming removal of range, I've looked at substitution range with xrange within my code. Direct substitution works for 90% percent of the case (i.e. for thing in xrange(number): ), however i can't change the

[Tutor] printing format with list

2008-01-24 Thread Andy Cheesman
Hi people Is there a way to use a list with printf formating without having to explicitly expanding the list after the % e.g a = [1, 2, 3] print Testing %i, %i, %i %(a[0], a[1], a[2]) Cheers Andy ___ Tutor maillist -

[Tutor] Saving Objects

2008-01-17 Thread Andy Cheesman
Hi people I've written a complex program in python/numpy/scipy which creates a dictionary of objects(which takes a while to create). I am hoping to save these objects to disk and then access them using a different session, thus bypassing the time to create the objects. My initial tests using

Re: [Tutor] Saving Objects

2008-01-17 Thread Andy Cheesman
That's great and it works too, thank you! My only arising question is why should i derive from object, so that you get a new-style class. I've looked online and found this (http://www.geocities.com/foetsch/python/new_style_classes.htm) but I not sure it tells why I would want to do this this

[Tutor] Finding a row match within a numpy array

2007-08-13 Thread Andy Cheesman
Dear nice people I'm trying to match a row (b) within a large numpy array (a). My most successful attempt is below hit = equal(b, a) total_hits = add.reduce(hit, 1) max_hit = argmax(total_hits, 0) answer = a[max_hit] where ... a = array([[ 0, 1, 2, 3], [ 4, 5, 6, 7],

Re: [Tutor] Simple way to compare Two lists

2007-08-10 Thread Andy Cheesman
I think you could use sets, (I asked a similar question a few days ago re numpy arrays). ie Convert both list to sets use Set intersection convert answer to lists HTH Andy Tom Fitzhenry wrote: On Fri, Aug 10, 2007 at 02:54:44AM -0700, Jaggo wrote: Can anyone think of any better way? If

Re: [Tutor] comparing two numpy arrays

2007-08-08 Thread Andy Cheesman
Bob Gailer wrote: Eric Brunson wrote: Bob Gailer wrote: Andy Cheesman wrote: Hi people, If I've two numpy arrays, is there a non-looping way of finding common values. (the example below has identical shapes for the arrays but this may not be the case in my scenario) e.g a = array([0

Re: [Tutor] Issue with iterating within lists, objects and functions

2007-08-03 Thread Andy Cheesman
Thanks for your help Kent The error was that I was trying to assign to a non-assignable reference as you highlighted. Everything works now Thanks Andy Kent Johnson wrote: Andy Cheesman wrote: for thing in [top, right, bottom, left]: eval(self. + thing).append(fish) You don't need

[Tutor] Issue with iterating within lists, objects and functions

2007-08-03 Thread Andy Cheesman
Dear people, Sorry for the vague title, I'm struggling to define the problem but an example will be better/clearer. If I've a list of strings, which relate to objects(lists) elsewhere in my code, I can call list action fine within the loop but I was wondering how do I apply an external function

[Tutor] rotation within arrays

2007-07-04 Thread Andy Cheesman
Dear People, I wondering if any of you lovely people can make a suggestion on a problem which I have with a n dimensional array. For example, I've a 3x3 array and I have been mapping an element from 1D to the one directly above it. 3-12 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 The problem

[Tutor] Animating changes with Numpy arrays

2007-06-26 Thread Andy Cheesman
Hi people Thanks to people's most excellent help with the Automatic generation of an all possible combinations array. I've got a beta version of my program working. However, I was wondering if there is an easy way to animate changes between arrays and to show the number of the loop which the

Re: [Tutor] Automatic generation of an all possible combinations array

2007-06-15 Thread Andy Cheesman
: return map(lambda x: x+[0], recursive_bit_list(n-1)) + \ map(lambda x: x+[1], recursive_bit_list(n-1)) Hope this helps! -Hugh On 6/14/07, *Andy Cheesman* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hi people I am trying to generate an array of all

[Tutor] Ipython and refreshing changed modules

2007-06-11 Thread Andy Cheesman
Dear People Silly question, I'm using Ipython and importing python modules which I've written. After a code modification, is there an easy, quick way to refresh changed modules? I've googled for the solutions but the answers does not seem clear! Andy