Re: [Tutor] How to get the keys of a dict inside a dict. ValueError: too many values to unpack

2011-08-09 Thread Peter Otten
Kayode Odeyemi wrote: > Thanks so much. This is exactly what I'm looking for. In addition, since > fields is obviously a dict, I won't want to have to display it's keys > repeatedly. Is there a way to get the keys once, have it displayed and > used as columns, then it's values are displayed beneat

[Tutor] function remember calls?

2011-08-09 Thread Robert Johansson
Hi all, This is my attempt to generate all pairs of relatively prime pairs of nonnegative integers (n, m) such that n + m <= N, using the Stern-Brocot tree. def rp_bounded_sum(n, i = 0, p = (0, 1), q = (1, 1), S = set([(0, 1), (1, 1)])): # Returns a set S with all relatively prime pairs (a,

Re: [Tutor] function remember calls?

2011-08-09 Thread Alan Gauld
On 09/08/11 08:44, Robert Johansson wrote: def rp_bounded_sum(n, i = 0, p = (0, 1), q = (1, 1), S = set([(0, 1), (1, 1)])): Strangely, (to me) it seems that the function remembers the set S between different calls: That's correct. Python evaluates the default parameter value once at functi

Re: [Tutor] Reprojection tool for vector datasets

2011-08-09 Thread Alan Gauld
On 09/08/11 02:00, Helen Brown wrote: ...I have place comment as to what I want the modules to do but that is as far as I can go. Can someone lead me to the finish line ? The problem is that your code is wholly reliant on the classes that you are using and unless you find somebody who is famil

Re: [Tutor] function remember calls?

2011-08-09 Thread Peter Otten
Robert Johansson wrote: > This is my attempt to generate all pairs of relatively prime pairs of > nonnegative integers (n, m) such that n + m <= N, using the Stern-Brocot > tree. > > def rp_bounded_sum(n, i = 0, p = (0, 1), q = (1, 1), S = set([(0, 1), (1, > 1)])): > # Returns a set S with al

Re: [Tutor] Reprojection tool for vector datasets

2011-08-09 Thread Steven D'Aprano
Helen Brown wrote: I am such a novice at this but I have gotten to a place where I am stuck. The attachment is what I have done so far but it also has an error for indentation. I will be working on that to. I have place comment as to what I want the modules to do but that is as far as I can go. C

[Tutor] Python mechanize: Auto follow meta refresh?

2011-08-09 Thread Troels Emtekær Linnet
Hi. I try to to make a python interaction with the form on: http://propka.ki.ku.dk/ I just try to set: version='v3.1' and PDBID='4AKE' After the click and sending the form it stops. It should automatically refresh. Here is my code: import mechanize, sys, time, os url = "http://propka.ki.ku.dk/

Re: [Tutor] General method for creating a partitioned window

2011-08-09 Thread Shwinn Ricci
I am using wxPython and OpenGL, although I would prefer to run a script in Maya, but this does not seem efficient for what I want to do, since maya only allows for 3-D visualization, not simultaneous 2-D/3-D viewing (i.e., side-by-side) On Thu, Aug 4, 2011 at 7:37 PM, Alan Gauld wrote: > On 04/

[Tutor] precision?

2011-08-09 Thread Shwinn Ricci
When comparing a given value with a database of values, but allowing for freedom due to variation at say, the thousandth digit, how does one generalize the precision to this degree? I don't want to truncate, so is there a round() function that takes into account what decimal place the value (databa

Re: [Tutor] precision?

2011-08-09 Thread Steven D'Aprano
Shwinn Ricci wrote: When comparing a given value with a database of values, but allowing for freedom due to variation at say, the thousandth digit, how does one generalize the precision to this degree? I don't want to truncate, so is there a round() function that takes into account what decimal p

Re: [Tutor] precision?

2011-08-09 Thread Chris Fuller
There's the one that comes with Python: http://docs.python.org/library/functions.html#round You should consider working with integers, though. Multiply all the values by 1000 and drop the fractional part. Cheers On Tuesday 09 August 2011, Shwinn Ricci wrote: > When comparing a given value wit

Re: [Tutor] General method for creating a partitioned window

2011-08-09 Thread Knacktus
Am 09.08.2011 16:44, schrieb Shwinn Ricci: I am using wxPython and OpenGL, although I would prefer to run a script in Maya, but this does not seem efficient for what I want to do, since maya only allows for 3-D visualization, not simultaneous 2-D/3-D viewing (i.e., side-by-side) On Thu, Aug 4

Re: [Tutor] General method for creating a partitioned window

2011-08-09 Thread Alan Gauld
On 09/08/11 15:44, Shwinn Ricci wrote: I am using wxPython and OpenGL, I don't know anything about how OpenGL works with wxPython. However in general one of the following strategies should work: 1) Create composite panel containing two child panels side by side. Create your graphics in the

Re: [Tutor] General method for creating a partitioned window

2011-08-09 Thread Prasad, Ramit
> Say I want one half of a 720 x 480 window be dedicated for > creating a > 2-D structure, and the other half for a 3-D structure. There > would be a > line 1 or 2 pixels thick straight down the window that would > divide the > two sectors. Ho

[Tutor] inserting degrees symbol in plot title

2011-08-09 Thread questions anon
I am creating a number of plots of temperature in degrees celsius and I would like the title of the plot to have - C° Through a search I found a way to print the symbol degree_symbol = unichr(176).encode("latin-1") print degree_symbol but when I add this to my plot title I receive a huge error (

Re: [Tutor] inserting degrees symbol in plot title

2011-08-09 Thread Steve Willoughby
On 09-Aug-11 20:11, questions anon wrote: I am creating a number of plots of temperature in degrees celsius and I would like the title of the plot to have - C° UnicodeDecodeError: 'ascii' codec can't decode byte 0xb0 in position 19: ordinal not in range(128) Putting the Unicode character in