Re: installing 2.6 on vista64

2009-07-23 Thread Jaime Fernandez del Rio
I have installed the 32 bit 2.6 and the 64 bit 3.1 on my machine running Vista 64 without any issues. Which of course has nothing to do with your problem On Thu, Jul 23, 2009 at 7:06 PM, DwBear75dwbea...@gmail.com wrote: I just downloaded and attempted to install python 2.6.2.  The

Re: Help with dictionaries and multidimensial lists

2009-06-23 Thread Jaime Fernandez del Rio
On Tue, Jun 23, 2009 at 4:45 PM, Cameron Pulsfordcameron.pulsf...@gmail.com wrote: Hey all, I have a dictionary that looks like this (small example version) {(1, 2): 0} named a so I can do a[1,2] which returns 0. What I also have is a list of coordinates into a 2 dimensional array that might

Re: Measuring Fractal Dimension ?

2009-06-17 Thread Jaime Fernandez del Rio
On Wed, Jun 17, 2009 at 1:52 PM, Mark Dickinsondicki...@gmail.com wrote: Maybe James is thinking of the standard theorem that says that if a sequence of continuous functions on an interval converges uniformly then its limit is continuous? Jaime was simply plain wrong... The example that

Re: Measuring Fractal Dimension ?

2009-06-16 Thread Jaime Fernandez del Rio
On Wed, Jun 17, 2009 at 4:50 AM, Lawrence D'Oliveirol...@geek-central.gen.new_zealand wrote: In message 7x63ew3uo9@ruckus.brouhaha.com,  wrote: Lawrence D'Oliveiro l...@geek-central.gen.new_zealand writes: I don't think any countable set, even a countably-infinite set, can have a fractal

Re: persistent composites

2009-06-14 Thread Jaime Fernandez del Rio
On Sun, Jun 14, 2009 at 4:27 PM, Aaron Bradycastiro...@gmail.com wrote: Before I go and flesh out the entire interfaces for the provided types, does anyone have a use for it? A real-world application of persistent data structures can be found here: http://stevekrenzel.com/persistent-list

Re: List comprehension and string conversion with formatting

2009-06-09 Thread Jaime Fernandez del Rio
On Tue, Jun 9, 2009 at 5:38 PM, stephen_bredplusbluemakespur...@gmail.com wrote: I'd like to convert a list of floats to a list of strings constrained to one .1f format. These don't work. Is there a better way? [.1f % i for i in l] or [(.1f % i) for i in l] There's a missing %, this does

Re: How do I sample randomly based on some probability(wightage)?

2009-05-26 Thread Jaime Fernandez del Rio
On Tue, May 26, 2009 at 8:42 PM, Sumitava Mukherjee sm...@cognobytes.com wrote: On May 26, 11:39 pm, Sumitava Mukherjee sm...@cognobytes.com wrote: [Oh, I forgot to mention. I am looking for sampling without replacement.] That means that, you'll have to code something that updates the sums of

Re: Regarding sort()

2009-05-25 Thread Jaime Fernandez del Rio
Hi Dhananjay, Sort has several optional arguments, the function's signature is as follows: s.sort([cmp[, key[, reverse]]]) If you store your data as a list of lists, to sort by the third column you could do something like: data.sort(None, lambda x : x[2]) For more complex sortings, as the one

Re: Regarding sort()

2009-05-25 Thread Jaime Fernandez del Rio
On Mon, May 25, 2009 at 10:15 AM, Chris Rebert c...@rebertia.com wrote: Erm, using a compare function rather than a key function slows down sorting /significantly/. In fact, the `cmp` parameter to list.sort() has been *removed* in Python 3.0 because of this. Makes a lot of sense, as you only

exec statement with/without prior compile...

2009-05-25 Thread Jaime Fernandez del Rio
These weekend I've been tearing down to pieces Michele Simionato's decorator module, that builds signature preserving decorators. At the heart of it all there is a dynamically generated function, which works something similar to this... ... src = def function(a,b,c) :\nreturn

Re: Just wondering

2009-05-15 Thread Jaime Fernandez del Rio
map is creating a new list of 10,000,000 items, not modifying the values inside list a. That's probably where your time difference comes from... Jaime On Fri, May 15, 2009 at 1:56 PM, Gediminas Kregzde gediminas.kreg...@gmail.com wrote: Hello, I'm Vilnius college II degree student and last

Re: Just wondering

2009-05-15 Thread Jaime Fernandez del Rio
(1) building another throwaway list and (2) function call overhead for calling doit() You can avoid (1) by using filter() instead of map() Are you sure of this? My python returns, when asked for help(filter) : Help on built-in function filter in module __builtin__: filter(...)

Re: Representing a Tree in Python

2009-05-15 Thread Jaime Fernandez del Rio
, May 13, 2009 at 10:49 AM, godshorse chinthak...@gmail.com wrote: On May 13, 3:19 pm, Jaime Fernandez del Rio jaime.f...@gmail.com wrote: Dijkstra's algorithm computes shortest paths between a node and _ALL_ other nodes in the graph. It is usually stopped once computing the shortest path

Re: Representing a Tree in Python

2009-05-13 Thread Jaime Fernandez del Rio
Dijkstra's algorithm computes shortest paths between a node and _ALL_ other nodes in the graph. It is usually stopped once computing the shortest path to the target node is done, but that's simply for efficiency, not a limitation of the algorithm. So you should be able to tweak the code you are

Re: Sorting a dictionary

2009-05-12 Thread Jaime Fernandez del Rio
This one I think I know... Try with: for k in sorted(word_count) : print k,=,word_count[k] You need to do the sorting before iterating over the keys... Jaime On Tue, May 12, 2009 at 1:54 PM, Ronn Ross ronn.r...@gmail.com wrote: I'm attempting to sort for the results of a dictionary. I

Re: putting date strings in order

2009-05-12 Thread Jaime Fernandez del Rio
If you simply want to generate an ordered list of months, start with it in order: dates = [x_jan,...,x_dec] and if the desired starting month is start = 6 # i.e. x_jun dates = dates[start - 1:] + dates[:start - 1] If you have to sort the list itself, I would use an intermediate

Re: putting date strings in order

2009-05-12 Thread Jaime Fernandez del Rio
On Tue, May 12, 2009 at 5:02 PM, MRAB goo...@mrabarnett.plus.com wrote: John Machin wrote: MRAB google at mrabarnett.plus.com writes: Sort the list, passing a function as the 'key' argument. The function should return an integer for the month, eg 0 for 'jan', 1 for 'feb'. If you want to