Re: Selecting k smallest or largest elements from a large list in python; (benchmarking)

2010-09-01 Thread Arnaud Delobelle
Dmitry Chichkov writes: > Given: a large list (10,000,000) of floating point numbers; > Task: fastest python code that finds k (small, e.g. 10) smallest > items, preferably with item indexes; > Limitations: in python, using only standard libraries (numpy & scipy > is Ok); > > I've tried several m

Re: PyPy and RPython

2010-09-01 Thread John Nagle
On 9/1/2010 10:49 AM, sarvi wrote: Is there a plan to adopt PyPy and RPython under the python foundation in attempt to standardize both. I have been watching PyPy and RPython evolve over the years. PyPy seems to have momentum and is rapidly gaining followers and performance. PyPy JIT and perf

Re: PyPy and RPython

2010-09-01 Thread Stefan Behnel
sarvi, 02.09.2010 07:06: Look at all the alternatives we have. Cython? Shedskin? I'll take PyPy anyday instead of them Fell free to do so, but don't forget that the choice of a language always depends on the specific requirements at hand. Cython has proven its applicability in a couple of lar

Re: importing excel data into a python matrix?

2010-09-01 Thread John Yeung
On Sep 1, 7:45 pm, Chris Rebert wrote: > On Wed, Sep 1, 2010 at 4:35 PM, patrick mcnameeking > > wrote: > > I'm working on a project where I have been given > > a 1000 by 1000 cell excel spreadsheet and I would > > like to be able to access the data using Python. > > Does anyone know of a way tha

Re: Queue cleanup

2010-09-01 Thread John Nagle
On 8/30/2010 12:22 AM, Paul Rubin wrote: I guess that is how the so-called smart pointers in the Boost C++ template library work. I haven't used them so I don't have personal experience with how convenient or reliable they are, or what kinds of constraints they imposed on programming style. I'v

Re: dirty problem 3 lines

2010-09-01 Thread alex23
bussiere bussiere wrote: > it's just as it seems : > i want to know how does ti works to get back an object from a string in > python : > pickle.loads("""b'\x80\x03]q\x00(K\x00K\x01e.'""") #doesn't work Repeating the question without providing any further information doesn't really help. This i

Re: PyPy and RPython

2010-09-01 Thread sarvi
On Sep 1, 6:49 pm, Benjamin Peterson wrote: > sarvi gmail.com> writes: > > Secondly I have always fantasized of never having to write C code yet > > get its compiled performance. > > With RPython(a strict subset of Python), I can actually compile it to > > C/Machine code > > RPython is not suppo

Re: Private variables

2010-09-01 Thread Rasjid Wilcox
On 2 September 2010 12:22, Ryan Kelly wrote: > On Thu, 2010-09-02 at 12:06 +1000, Ryan Kelly wrote: >> On Thu, 2010-09-02 at 11:10 +1000, Rasjid Wilcox wrote: >> > Hi all, >> > >> > I am aware the private variables are generally done via convention >> > (leading underscore), but I came across a te

Re: killing all subprocess childrens

2010-09-01 Thread Astan Chee
Chris Rebert wrote: import os import psutil # http://code.google.com/p/psutil/ # your piece of code goes here myself = os.getpid() for proc in psutil.process_iter(): Is there a way to do this without psutil or installing any external modules or doing it from python2.5? Just wondering. Than

Re: killing all subprocess childrens

2010-09-01 Thread Chris Rebert
On Wed, Sep 1, 2010 at 8:12 PM, Astan Chee wrote: > Hi, > I have a piece of code that looks like this: > > import subprocess > retcode = subprocess.call(["java","test","string"]) > print "Exited with retcode " + str(retcode) > > What I'm trying to do (and wondering if its possible) is to make sure

killing all subprocess childrens

2010-09-01 Thread Astan Chee
Hi, I have a piece of code that looks like this: import subprocess retcode = subprocess.call(["java","test","string"]) print "Exited with retcode " + str(retcode) What I'm trying to do (and wondering if its possible) is to make sure that any children (and any descendants) of this process is kil

Re: Performance: sets vs dicts.

2010-09-01 Thread [email protected]
On 09/01/2010 04:51 PM, Raymond Hettinger wrote: > On Aug 30, 6:03 am, [email protected] (Aahz) wrote: >> That reminds me: one co-worker (who really should have known better ;-) >> had the impression that sets were O(N) rather than O(1). Although >> writing that off as a brain-fart seems approp

Re: PyPy and RPython

2010-09-01 Thread alex23
On Sep 2, 3:49 am, sarvi wrote: > Yet I see this forum relatively quite on PyPy or Rpython ?  Any > reasons??? For me, it's two major ones: 1. PyPy only recently hit a stability/performance point that makes it worth checking out, 2. Using non-pure-python modules wasn't straightforward (at least

Re: Problem checking an existing browser cookie

2010-09-01 Thread Nik the Greek
On 31 Αύγ, 11:07, Nik the Greek wrote: > On 30 Αύγ, 20:50, MRAB wrote: > > > > > > > > > > > On 30/08/2010 18:16, Nik the Greek wrote: > > > > On 30 Αύγ, 19:41, MRAB  wrote: > > >> On 30/08/2010 04:33, Nik the Greek wrote: > > > >>> On 30 Αύγ, 06:12, MRAB    wrote: > > > This part: > > > >>>

Re: Private variables

2010-09-01 Thread Ryan Kelly
On Thu, 2010-09-02 at 12:06 +1000, Ryan Kelly wrote: > On Thu, 2010-09-02 at 11:10 +1000, Rasjid Wilcox wrote: > > Hi all, > > > > I am aware the private variables are generally done via convention > > (leading underscore), but I came across a technique in Douglas > > Crockford's book "Javascript:

Re: Private variables

2010-09-01 Thread Ryan Kelly
On Thu, 2010-09-02 at 11:10 +1000, Rasjid Wilcox wrote: > Hi all, > > I am aware the private variables are generally done via convention > (leading underscore), but I came across a technique in Douglas > Crockford's book "Javascript: The Good Parts" for creating private > variables in Javascript,

Re: PyPy and RPython

2010-09-01 Thread Benjamin Peterson
sarvi gmail.com> writes: > > > Is there a plan to adopt PyPy and RPython under the python foundation > in attempt to standardize both. There is not. > > Secondly I have always fantasized of never having to write C code yet > get its compiled performance. > With RPython(a strict subset of Pyt

Private variables

2010-09-01 Thread Rasjid Wilcox
Hi all, I am aware the private variables are generally done via convention (leading underscore), but I came across a technique in Douglas Crockford's book "Javascript: The Good Parts" for creating private variables in Javascript, and I'd thought I'd see how it translated to Python. Here is my atte

Selecting k smallest or largest elements from a large list in python; (benchmarking)

2010-09-01 Thread Dmitry Chichkov
Given: a large list (10,000,000) of floating point numbers; Task: fastest python code that finds k (small, e.g. 10) smallest items, preferably with item indexes; Limitations: in python, using only standard libraries (numpy & scipy is Ok); I've tried several methods. With N = 10,000,000, K = 10 The

Re: Python libs on Windows ME

2010-09-01 Thread [email protected]
Damn Small Linux could work. If even that won't work, perhaps it's time to scrap your old fossil for parts and buy a modern computer. Even a netbook would probably be an improvement based on your situation. -- http://mail.python.org/mailman/listinfo/python-list

Re: Performance: sets vs dicts.

2010-09-01 Thread John Bokma
Robert Kern writes: > On 9/1/10 4:40 PM, John Bokma wrote: >> Arnaud Delobelle writes: >> >>> Terry Reedy writes: [...] >>> I don't understand what you're trying to say. Aahz didn't claim that >>> random list element access was constant time, he said it was O(1) (and >>> that it should be pa

Re: Performance: sets vs dicts.

2010-09-01 Thread John Bokma
Terry Reedy writes: > On 9/1/2010 5:40 PM, John Bokma wrote: [..] > Yes, I switched, because 'constant time' is a comprehensible claim > that can be refuted and because that is how some will interpret O(1) > (see below for proof;-). You make it now sound alsof this interpretation is not correc

Re: DeprecationWarning

2010-09-01 Thread Chris Rebert
On Wed, Sep 1, 2010 at 8:58 AM, cerr wrote: > Hi There, > > I would like to create an scp handle and download a file from a > client. I have following code: > but what i'm getting is this and no file is downloaded...: > /opt/lampp/cgi-bin/attachment.py:243: DeprecationWarning: > BaseException.mes

Re: importing excel data into a python matrix?

2010-09-01 Thread Chris Rebert
On Wed, Sep 1, 2010 at 4:35 PM, patrick mcnameeking wrote: > Hello list, > I've been working with Python now for about a year using it primarily for > scripting in the Puredata graphical programming environment.  I'm working on > a project where I have been given a 1000 by 1000 cell excel spreadsh

Re: importing excel data into a python matrix?

2010-09-01 Thread geremy condra
On Wed, Sep 1, 2010 at 4:35 PM, patrick mcnameeking wrote: > Hello list, > I've been working with Python now for about a year using it primarily for > scripting in the Puredata graphical programming environment.  I'm working on > a project where I have been given a 1000 by 1000 cell excel spreadsh

importing excel data into a python matrix?

2010-09-01 Thread patrick mcnameeking
Hello list, I've been working with Python now for about a year using it primarily for scripting in the Puredata graphical programming environment. I'm working on a project where I have been given a 1000 by 1000 cell excel spreadsheet and I would like to be able to access the data using Python. Do

Re: Performance: sets vs dicts.

2010-09-01 Thread Terry Reedy
On 9/1/2010 5:40 PM, John Bokma wrote: Arnaud Delobelle writes: Terry Reedy writes: On 9/1/2010 11:40 AM, Aahz wrote: I think that any implementation that doesn't have O(1) for list element access is fundamentally broken, Whereas I think that that claim is fundamentally broken in multipl

Re: Performance: sets vs dicts.

2010-09-01 Thread Raymond Hettinger
On Aug 30, 6:03 am, [email protected] (Aahz) wrote: > That reminds me: one co-worker (who really should have known better ;-) > had the impression that sets were O(N) rather than O(1).  Although > writing that off as a brain-fart seems appropriate, it's also the case > that the docs don't really

Re: Performance: sets vs dicts.

2010-09-01 Thread Robert Kern
On 9/1/10 4:40 PM, John Bokma wrote: Arnaud Delobelle writes: Terry Reedy writes: But such a document, after stating that array access may be thought of as constant time on current hardware to a useful first approximation, should also state that repeated seqeuntial accessess may be *much*

Re: what is this kind of string: b'string' ?

2010-09-01 Thread Gary Herron
On 09/01/2010 02:32 PM, Stef Mientki wrote: in winpdb I see strings like this: a = b'string' a 'string' type(a) what's the "b" doing in front of the string ? thanks, Stef Mientki In Python2 the b is meaningless (but allowed for compatibility and future

Email Previews

2010-09-01 Thread Paul Jefferson
Hello, I'm currently trying to write a quick script that takes email message objects and generates quick snippet previews (like the iPhone does when you are in the menu) but I'm struggling. I was just wondering before I started to put a lot of work in this if there were any existing scripts out th

Re: Performance: sets vs dicts.

2010-09-01 Thread John Bokma
Arnaud Delobelle writes: > Terry Reedy writes: > >> On 9/1/2010 11:40 AM, Aahz wrote: >>> I think that any implementation >>> that doesn't have O(1) for list element access is fundamentally broken, >> >> Whereas I think that that claim is fundamentally broken in multiple ways. >> >>> and we shou

Re: what is this kind of string: b'string' ?

2010-09-01 Thread Robert Kern
On 9/1/10 4:32 PM, Stef Mientki wrote: in winpdb I see strings like this: a = b'string' a 'string' type(a) what's the "b" doing in front of the string ? http://docs.python.org/py3k/library/stdtypes.html#bytes-and-byte-array-methods -- Robert Kern "I have come to believe that the whol

what is this kind of string: b'string' ?

2010-09-01 Thread Stef Mientki
in winpdb I see strings like this: >>>a = b'string' >>>a 'string' >>> type(a) what's the "b" doing in front of the string ? thanks, Stef Mientki -- http://mail.python.org/mailman/listinfo/python-list

Re: Performance: sets vs dicts.

2010-09-01 Thread Terry Reedy
On 9/1/2010 2:42 AM, Paul Rubin wrote: Terry Reedy writes: Does anyone seriously think that an implementation should be rejected as an implementation if it intellegently did seq[n] lookups in log2(n)/31 time units for all n (as humans would do), instead of stupidly taking 1 time unit for all n<

Re: C++ - Python API

2010-09-01 Thread Markus Kraus
Thanks for the answer On 1 Sep., 22:29, Thomas Jollans wrote: > On Wednesday 01 September 2010, it occurred to Markus Kraus to exclaim: > > > So the feature overview: > > First, the obligatory things you don't want to hear: Have you had a look at > similar efforts? A while ago, Aahz posted someth

Re: Performance: sets vs dicts.

2010-09-01 Thread Arnaud Delobelle
Terry Reedy writes: > On 9/1/2010 11:40 AM, Aahz wrote: >> I think that any implementation >> that doesn't have O(1) for list element access is fundamentally broken, > > Whereas I think that that claim is fundamentally broken in multiple ways. > >> and we should probably document that somewhere.

Re: C++ - Python API

2010-09-01 Thread Thomas Jollans
On Wednesday 01 September 2010, it occurred to Markus Kraus to exclaim: > So the feature overview: First, the obligatory things you don't want to hear: Have you had a look at similar efforts? A while ago, Aahz posted something very similar on this very list. You should be able to find it in any

Re: parsing string into dict

2010-09-01 Thread Arnaud Delobelle
Tim Arnold writes: > Hi, > I have a set of strings that are *basically* comma separated, but with > the exception that if a comma occur insides curly braces it is not a > delimiter. Here's an example: > > [code=one, caption={My Analysis for \textbf{t}, Version 1}, continued] > > I'd like to pars

Re: Performance: sets vs dicts.

2010-09-01 Thread Terry Reedy
On 9/1/2010 11:40 AM, Aahz wrote: I think that any implementation that doesn't have O(1) for list element access is fundamentally broken, Whereas I think that that claim is fundamentally broken in multiple ways. and we should probably document that somewhere. I agree that *current* algorith

C++ - Python API

2010-09-01 Thread Markus Kraus
Hi guys i worked on this for severl days (or even weeks?!) now, but im nearly finished with it: A complete C++ to Python API which allows you to use python as a scripting language for your C++ projects. Simple example: --- python code --- def greet( player ): print( "Hello player " + player.get

Re: Source code for itertools

2010-09-01 Thread vsoler
On 1 sep, 06:30, Tim Roberts wrote: > vsoler wrote: > >On 31 ago, 04:42, Paul Rubin wrote: > >> vsoler writes: > >> > I was expecting an itertools.py file, but I don't see it in your list. > >> >> ./python3.1-3.1.2+20100829/Modules/itertoolsmodule.c > > >> looks promising.  Lots of stdlib modul

Re: Source code for itertools

2010-09-01 Thread vsoler
On 31 ago, 05:33, Rolando Espinoza La Fuente wrote: > On Mon, Aug 30, 2010 at 11:06 PM, vsoler wrote: > > On 31 ago, 04:42, Paul Rubin wrote: > >> vsoler writes: > >> > I was expecting an itertools.py file, but I don't see it in your list. > >> >> ./python3.1-3.1.2+20100829/Modules/itertoolsmod

Installation problem: Python 2.6.6 (32-Bit) on Windows 7 (32-Bit)

2010-09-01 Thread Cappy2112
Has anyone else had problems running the msi for Python 2.6.6 on Windows 7 Professional? If I don't check "Compile .py to byte code", the installer completes without error. Checking "Compile .py to byte code" causes the following to be displayed "There is a problem with the windows installer pac

Re: Dumb Stupid Question About List and String

2010-09-01 Thread Xavier Ho
2010/9/2 Alban Nona > Hello Xavier, working great ! thank you very much ! :p > Do you know by any chance if dictionnary can be sorted asthis: > Look at the sorted() global function in the Python API. ;] Cheers, Xav -- http://mail.python.org/mailman/listinfo/python-list

Re: Windows vs. file.read

2010-09-01 Thread Mike
On Sep 1, 12:31 pm, MRAB wrote: > You should open the files in binary mode, not text mode, ie file(path, > "rb"). Text mode is the default. Not a problem on *nix because the line > ending is newline. Thanks. That was it. -- http://mail.python.org/mailman/listinfo/python-list

PyPy and RPython

2010-09-01 Thread sarvi
Is there a plan to adopt PyPy and RPython under the python foundation in attempt to standardize both. I have been watching PyPy and RPython evolve over the years. PyPy seems to have momentum and is rapidly gaining followers and performance. PyPy JIT and performance would be a good thing for the

parsing string into dict

2010-09-01 Thread Tim Arnold
Hi, I have a set of strings that are *basically* comma separated, but with the exception that if a comma occur insides curly braces it is not a delimiter. Here's an example: [code=one, caption={My Analysis for \textbf{t}, Version 1}, continued] I'd like to parse that into a dictionary (note that

Re: Fibonacci: How to think recursively

2010-09-01 Thread Mike
The most straightforward method would be to apply the formula directly. Loop on j computing Fj along the way if n<=1 : return n Fold=0 Fnew=1 for j in range(2,n) : Fold, Fnew = Fnew, Fold+Fnew return Fnew Even simpler: return round(((1+sqrt(5.))/2)**n/sqrt(5.)) -- http://mail.python.org/mail

Re: Windows vs. file.read

2010-09-01 Thread David Robinow
On Wed, Sep 1, 2010 at 1:03 PM, Mike wrote: > I have a ppm file that python 2.5 on Windows XP cannot read > completely. > Python on linux can read the file with no problem > Python on Windows can read similar files. > I've placed test code and data here: > http://www.cs.ndsu.nodak.edu/~hennebry/pp

Re: Windows vs. file.read

2010-09-01 Thread MRAB
On 01/09/2010 18:03, Mike wrote: I have a ppm file that python 2.5 on Windows XP cannot read completely. Python on linux can read the file with no problem Python on Windows can read similar files. I've placed test code and data here: http://www.cs.ndsu.nodak.edu/~hennebry/ppm_test.zip Within the

Re: Dumb Stupid Question About List and String

2010-09-01 Thread MRAB
On 01/09/2010 17:49, Alban Nona wrote: Hello Xavier, Thank you :) Well what Iam trying to generate is that kind of result: listn1=['ELM001_DIF', 'ELM001_SPC', 'ELM001_RFL', 'ELM001_SSS', 'ELM001_REFR', 'ELM001_ALB', 'ELM001_AMB', 'ELM001_NRM', 'ELM001_MVE', 'ELM001_DPF', 'ELM001_SDW', 'ELM001_

Re: Dumb Stupid Question About List and String

2010-09-01 Thread Xavier Ho
On 2 September 2010 02:49, Alban Nona wrote: > Well what Iam trying to generate is that kind of result: > > listn1=['ELM001_DIF', 'ELM001_SPC', 'ELM001_RFL', 'ELM001_SSS', > 'ELM001_REFR', 'ELM001_ALB', 'ELM001_AMB', 'ELM001_NRM', 'ELM001_MVE', > 'ELM001_DPF', 'ELM001_SDW', 'ELM001_MAT', 'ELM001_

Windows vs. file.read

2010-09-01 Thread Mike
I have a ppm file that python 2.5 on Windows XP cannot read completely. Python on linux can read the file with no problem Python on Windows can read similar files. I've placed test code and data here: http://www.cs.ndsu.nodak.edu/~hennebry/ppm_test.zip Within the directory ppm_test, type python ppm

scp with paramiko

2010-09-01 Thread cerr
Hi There, I want to download a file from a client using paramiko. I found plenty of ressources using google on how to send a file but none that would describe how to download files from a client. Help would be appreciated! Thanks a lot! Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: Optimising literals away

2010-09-01 Thread MRAB
On 01/09/2010 14:25, Lie Ryan wrote: On 09/01/10 17:06, Stefan Behnel wrote: MRAB, 31.08.2010 23:53: On 31/08/2010 21:18, Terry Reedy wrote: On 8/31/2010 12:33 PM, Aleksey wrote: On Aug 30, 10:38 pm, Tobias Weber wrote: Hi, whenever I type an "object literal" I'm unsure what optimisation wil

Re: Newby Needs Help with Python code

2010-09-01 Thread Peter Otten
Nally Kaunda-Bukenya wrote: > I hope someone can help me. I am new to Python and trying to achive the > following: > 1) I would like to populate the Tot_Ouf_Area field with total area of > each unique outfall_id (code attempted below,but Tot_Ouf_Area not > populating) > 2) I would also

Re: Dumb Stupid Question About List and String

2010-09-01 Thread Alban Nona
Hello Xavier, Thank you :) Well what Iam trying to generate is that kind of result: listn1=['ELM001_DIF', 'ELM001_SPC', 'ELM001_RFL', 'ELM001_SSS', 'ELM001_REFR', 'ELM001_ALB', 'ELM001_AMB', 'ELM001_NRM', 'ELM001_MVE', 'ELM001_DPF', 'ELM001_SDW', 'ELM001_MAT', 'ELM001_WPP'] listn2 = ['ELM002_DI

Re: Dumb Stupid Question About List and String

2010-09-01 Thread Xavier Ho
On 2 September 2010 01:11, Alban Nona wrote: > Hello, > > seems to have the same error with python. > In fact I was coding within nuke, a 2d compositing software (not the best) > unfortunately, I dont see how I can use dictionnary to do what I would like > to do. > Hello Alban, The reason it's

Better multiprocessing and data persistance with C level serialisation

2010-09-01 Thread [email protected]
I was thinking about this for a while. Owing to a lack of forking or START/STOP signals, all process interchange in CPython requires serialisation, usually pickling. But what if that could be done within the interpreter core instead of by the script, creating a complete internal representation t

Re: Performance: sets vs dicts.

2010-09-01 Thread Stefan Behnel
Aahz, 01.09.2010 17:40: I still think that making a full set of algorithmic guarantees is a Bad Idea, but I think that any implementation that doesn't have O(1) for list element access is fundamentally broken, and we should probably document that somewhere. +1 Stefan -- http://mail.python.org

DeprecationWarning

2010-09-01 Thread cerr
Hi There, I would like to create an scp handle and download a file from a client. I have following code: import sys, os, paramiko,time from attachment import SCPClient transport = paramiko.Transport((prgIP, 22)) try: transport.connect(username='root', password=prgPass) except IOError

Re: [ANN] git peer-to-peer bittorrent experiment: first milestone reached

2010-09-01 Thread Stefan Behnel
Luke Kenneth Casson Leighton, 01.09.2010 17:14: this is to let people know that a first milestone has been reached in an experiment to combine git with a file-sharing protocol, thus making it possible to use git for truly distributed software development Basically, BitTorrent only works well wh

Re: Performance: sets vs dicts.

2010-09-01 Thread Aahz
In article , Jerry Hill wrote: >On Tue, Aug 31, 2010 at 10:09 AM, Aahz wrote: >> >> I suggest that we should agree on these guarantees and document them in >> the core. > >I can't get to the online python-dev archives from work (stupid >filter!) so I can't give you a link to the archives, but th

[ANN] git peer-to-peer bittorrent experiment: first milestone reached

2010-09-01 Thread Luke Kenneth Casson Leighton
http://gitorious.org/python-libbittorrent/pybtlib this is to let people know that a first milestone has been reached in an experiment to combine git with a file-sharing protocol, thus making it possible to use git for truly distributed software development and other file-revision-management operat

Re: Dumb Stupid Question About List and String

2010-09-01 Thread Alban Nona
Hello, seems to have the same error with python. In fact I was coding within nuke, a 2d compositing software (not the best) unfortunately, I dont see how I can use dictionnary to do what I would like to do. 2010/9/1 Xavier Ho > On 2 September 2010 00:47, Alban Nona wrote: > >> Hello, >> >> So

Re: Dumb Stupid Question About List and String

2010-09-01 Thread Xavier Ho
On 2 September 2010 00:47, Alban Nona wrote: > Hello, > > So I figure out this night how to create automatically varibales via > vars(), the script seems to work, exept that where it should give me a list > like : > [ELM004_DIF,ELM004_SPC,ELM004_RFL,ELM004_SSS, ELM004_REFR, ELM004_ALB, > etc...]

Re: Dumb Stupid Question About List and String

2010-09-01 Thread Alban Nona
Hello, So I figure out this night how to create automatically varibales via vars(), the script seems to work, exept that where it should give me a list like : [ELM004_DIF,ELM004_SPC,ELM004_RFL,ELM004_SSS, ELM004_REFR, ELM004_ALB, etc...] it gave me just one entry in my list, and the last one [ELM0

Re: Fibonacci: How to think recursively

2010-09-01 Thread Neil Cerutti
On 2010-09-01, Albert van der Horst wrote: > [Didn't you mean: I don't understand what you mean by > overlapping recursions? You're right about the base case, so > clearly the OP uses some confusing terminology.] > > I see a problem with overlapping recursions. Unless automatic > memoizing is one

Re: fairly urgent request: paid python (or other) work required

2010-09-01 Thread Ben Finney
lkcl writes: > i apologise for having to contact so many people but this is fairly > urgent, and i'm running out of time and options. […] I sympathise with your situation; work for skilled practicioners is scarce in many places right now. For that reason, many people are likely to be in your po

Re: Reversing a List

2010-09-01 Thread Dave Angel
Victor Subervi wrote: Hi; I have this code: cursor.execute('describe products;') cols = [item[0] for item in cursor] cols = cols.reverse() cols.append('Delete') cols = cols.reverse() Unfortunately, the list doesn't reverse. If I print cols after the first reverse(), it prints None. Pl

Re: Performance: sets vs dicts.

2010-09-01 Thread Stefan Behnel
Lie Ryan, 01.09.2010 15:46: On 09/01/10 00:09, Aahz wrote: However, I think there are some rock-bottom basic guarantees we can make regardless of implementation. Does anyone seriously think that an implementation would be accepted that had anything other than O(1) for index access into tuples a

Re: Reversing a List

2010-09-01 Thread Shashwat Anand
On Wed, Sep 1, 2010 at 6:45 PM, Matt Saxton wrote: > On Wed, 1 Sep 2010 09:00:03 -0400 > Victor Subervi wrote: > > > Hi; > > I have this code: > > > > cursor.execute('describe products;') > > cols = [item[0] for item in cursor] > > cols = cols.reverse() > > cols.append('Delete') > > co

Re: Reversing a List

2010-09-01 Thread Victor Subervi
On Wed, Sep 1, 2010 at 9:17 AM, Shashank Singh < [email protected]> wrote: > reverse reverses in-place > > >>> l = [1, 2, 3] > >>> r = l.reverse() > >>> r is None > True > >>> l > [3, 2, 1] > >>> > Ah. Thanks! beno -- http://mail.python.org/mailman/listinfo/python-list

Re: Reversing a List

2010-09-01 Thread Shashank Singh
reverse reverses in-place >>> l = [1, 2, 3] >>> r = l.reverse() >>> r is None True >>> l [3, 2, 1] >>> On Wed, Sep 1, 2010 at 6:30 PM, Victor Subervi wrote: > Hi; > I have this code: > > cursor.execute('describe products;') > cols = [item[0] for item in cursor] > cols = cols.reverse() >

Re: Reversing a List

2010-09-01 Thread Matt Saxton
On Wed, 1 Sep 2010 09:00:03 -0400 Victor Subervi wrote: > Hi; > I have this code: > > cursor.execute('describe products;') > cols = [item[0] for item in cursor] > cols = cols.reverse() > cols.append('Delete') > cols = cols.reverse() > > Unfortunately, the list doesn't reverse. If I pr

Re: Saving (unusual) linux filenames

2010-09-01 Thread Albert van der Horst
In article , Grant Edwards wrote: >On 2010-08-31, MRAB wrote: >> On 31/08/2010 17:58, Grant Edwards wrote: >>> On 2010-08-31, MRAB wrote: On 31/08/2010 15:49, [email protected] wrote: > Hi, > > i have a script that reads and writes linux paths in a file. I save the > path (as

Re: [Pickle]dirty problem 3 lines

2010-09-01 Thread bussiere bussiere
it's just as it seems : i want to know how does ti works to get back an object from a string in python : pickle.loads("""b'\x80\x03]q\x00(K\x00K\x01e.'""") #doesn't work Google Fan boy On Wed, Sep 1, 2010 at 5:23 AM, MRAB wrote: > On 01/09/2010 03:33, bussiere bussiere wrote: >> >> i know it's

Reversing a List

2010-09-01 Thread Victor Subervi
Hi; I have this code: cursor.execute('describe products;') cols = [item[0] for item in cursor] cols = cols.reverse() cols.append('Delete') cols = cols.reverse() Unfortunately, the list doesn't reverse. If I print cols after the first reverse(), it prints None. Please advise. Also, is th

YAMI4 v. 1.1.0 - messaging solution for distributed systems

2010-09-01 Thread Maciej Sobczak
I am pleased to announce that the new version of YAMI4, 1.1.0, has been just released and is available for download. http://www.inspirel.com/yami4/ This new version extends the coverage of supported programming languages with a completely new Python3 module, which allows full integration of built

fairly urgent request: paid python (or other) work required

2010-09-01 Thread lkcl
i apologise for having to contact so many people but this is fairly urgent, and i'm running out of time and options. i'm a free software programmer, and i need some paid work - preferably python - fairly urgently, so that i can pay for food and keep paying rent, and so that my family doesn't get

Re: Fibonacci: How to think recursively

2010-09-01 Thread Albert van der Horst
In article , Mel wrote: >Baba wrote: > >> Level: beginner >> >> I would like to know how to approach the following Fibonacci problem: >> How may rabbits do i have after n months? >> >> I'm not looking for the code as i could Google that very easily. I'm >> looking for a hint to put me on the righ

Re: Performance: sets vs dicts.

2010-09-01 Thread Lie Ryan
On 09/01/10 00:09, Aahz wrote: > In article , > Jerry Hill wrote: >> On Mon, Aug 30, 2010 at 7:42 PM, Aahz wrote: >>> >>> Possibly; IMO, people should not need to run timeit to determine basic >>> algorithmic speed for standard Python datatypes. >> >> http://wiki.python.org/moin/TimeComplexity t

Re: Optimising literals away

2010-09-01 Thread Lie Ryan
On 09/01/10 17:06, Stefan Behnel wrote: > MRAB, 31.08.2010 23:53: >> On 31/08/2010 21:18, Terry Reedy wrote: >>> On 8/31/2010 12:33 PM, Aleksey wrote: On Aug 30, 10:38 pm, Tobias Weber wrote: > Hi, > whenever I type an "object literal" I'm unsure what optimisation > will do > t

Re: Newby Needs Help with Python code

2010-09-01 Thread Rami Chowdhury
Hi Esther, On Wed, Sep 1, 2010 at 13:29, Nally Kaunda-Bukenya wrote: > #THE PROGRAM: > import arcgisscripting > gp=arcgisscripting.create() > gp.Workspace = "C:\\NPDES\\NPDES_PYTHON.mdb" > fc = "Outfalls_ND" > > try: >     # Set the field to create a list of unique values >     fieldname = "O

Newby Needs Help with Python code

2010-09-01 Thread Nally Kaunda-Bukenya
  Dear Python experts, I hope someone can help me. I am new to Python and trying to achive the following: 1)  I would like to populate the Tot_Ouf_Area field with total area of each unique outfall_id (code attempted below,but Tot_Ouf_Area not populating) 2)  I would also like to get the

Re: Queue cleanup

2010-09-01 Thread Paul Rubin
Lawrence D'Oliveiro writes: >> Refcounting is susceptable to the same pauses for reasons already >> discussed. > > Doesn’t seem to happen in the real world, though. def f(n): from time import time a = [1] * n t0 = time() del a t1 = time() return

Re: Optimising literals away

2010-09-01 Thread Stefan Behnel
MRAB, 31.08.2010 23:53: On 31/08/2010 21:18, Terry Reedy wrote: On 8/31/2010 12:33 PM, Aleksey wrote: On Aug 30, 10:38 pm, Tobias Weber wrote: Hi, whenever I type an "object literal" I'm unsure what optimisation will do to it. Optimizations are generally implentation dependent. CPython curre

Re: Queue cleanup

2010-09-01 Thread Paul Rubin
Lawrence D'Oliveiro writes: > Whereas garbage collection will happen at some indeterminate time long after > the last access to the object, when it very likely will no longer be in the > cache, and have to be brought back in just to be freed, GC's for large systems generally don't free (or eve