Re: Egos, heartlessness, and limitations

2011-04-15 Thread Steven D'Aprano
On Fri, 15 Apr 2011 13:55:58 +1000, Ben Finney wrote: > Steven D'Aprano writes: > >> Save yourself a lot of time and just killfile him now. You'll thank me >> for it later. > > You never thanked *me* for it, after you eventually realised that was > the right decision :-) It's not "later" enoug

Re: Pythonic infinite for loop?

2011-04-15 Thread Paul Rubin
Chris Angelico writes: That loop will exit at the first gap in the sequence. If that's what you want, you could try (untested): from itertools import takewhile seq = takewhile(lambda n: ('Keyword%d'%n) in dct, count(1)) lst = map(dct.get, seq) This does 2 lookups per key, which you co

Re: Pythonic infinite for loop?

2011-04-15 Thread Chris Angelico
On Fri, Apr 15, 2011 at 5:24 PM, Paul Rubin wrote: > This does 2 lookups per key, which you could avoid by making the code > uglier (untested): > >   sentinel = object() >   seq = (dct.get('Keyword%d'%i,sentinel) for i in count(1)) >   lst = list(takewhile(lambda x: x != sentinel, seq)) If I unde

Re: Pythonic infinite for loop?

2011-04-15 Thread Paul Rubin
Chris Angelico writes: >>   sentinel = object() >>   seq = (dct.get('Keyword%d'%i,sentinel) for i in count(1)) >>   lst = list(takewhile(lambda x: x != sentinel, seq)) > > If I understand this code correctly, that's creating generators, > right? It won't evaluate past the sentinel at all? Right,

Re: memory usage multi value hash

2011-04-15 Thread Algis Kabaila
On Friday 15 April 2011 02:13:51 christian wrote: > Hello, > > i'm not very experienced in python. Is there a way doing > below more memory efficient and maybe faster. > I import a 2-column file and then concat for every unique > value in the first column ( key) the value from the second > colum

Re: Pythonic infinite for loop?

2011-04-15 Thread Peter Otten
Paul Rubin wrote: > Chris Angelico writes: >>> sentinel = object() >>> seq = (dct.get('Keyword%d'%i,sentinel) for i in count(1)) >>> lst = list(takewhile(lambda x: x != sentinel, seq)) >> >> If I understand this code correctly, that's creating generators, >> right? It won't evaluate past the sent

Re: memory usage multi value hash

2011-04-15 Thread Peter Otten
Terry Reedy wrote: > On 4/14/2011 12:55 PM, Peter Otten wrote: > >> I don't expect that it matters much, but you don't need to sort your data >> if you use a dictionary anyway: > > Which means that one can build the dict line by line, as each is read, > instead of reading the entire file into me

Re: Pythonic infinite for loop?

2011-04-15 Thread Peter Otten
Chris Angelico wrote: > Apologies for interrupting the vital off-topic discussion, but I have > a real Python question to ask. > > I'm doing something that needs to scan a dictionary for elements that > have a particular beginning and a numeric tail, and turn them into a > single list with some p

Re: Pythonic infinite for loop?

2011-04-15 Thread Chris Angelico
On Fri, Apr 15, 2011 at 6:25 PM, Peter Otten <__pete...@web.de> wrote: > The initial data structure seems less than ideal. You might be able to > replace it with a dictionary like > > {"Keyword": [value_for_keyword_1, value_for_keyword_2, ...]} > > if you try hard enough. The initial data structur

PYTHONPATH

2011-04-15 Thread Algis Kabaila
Hi, An elementary question that is bugging me, regarding sys.path values.sys.path can be altered easily, but the changes last for the current session only. I would like the changes to stay for several sessions. Is PYTHONPATH a system variable that sets the path for several sessions and if so,

Re: TextWrangler "run" command not working properly

2011-04-15 Thread Fabio
In article <382709dd-5e3f-4b07-a642-4ce141ef4...@18g2000prd.googlegroups.com>, Jon Clements wrote: > http://www.velocityreviews.com/forums/t570137-textwrangler-and-new-python-vers > ion-mac.html Thank you for the reply Jon. I saw the post in velocityreviews. Unfortunately it doesn't solve my

Can you advice a Python library to query a lan subnet with SNMP and collect MAC addresses of nodes?

2011-04-15 Thread Aldo Ceccarelli
Hello All, in my specific problem I will be happy of a response where possible to: 1. distinguish different operating systems of answering nodes 2. collect responses of Wyse thin-clients with "Thin OS" to get node name and MAC address in particular Thanks a lot in advance for any sharing / forwar

Re: PYTHONPATH

2011-04-15 Thread Chris Rebert
On Fri, Apr 15, 2011 at 1:33 AM, Algis Kabaila wrote: > Hi, > > An elementary question that is bugging me, regarding sys.path > values.sys.path can be altered easily, but the changes last for > the current session only. I would like the changes to stay for > several sessions.  Is PYTHONPATH a syst

Re: [OT] Free software versus software idea patents

2011-04-15 Thread Dan Stromberg
On Thu, Apr 14, 2011 at 1:46 PM, Westley Martínez wrote: > On Thu, 2011-04-14 at 14:02 +, Steven D'Aprano wrote: >> On Thu, 14 Apr 2011 19:15:05 +1000, Chris Angelico wrote: >> >> > 4) Assumes people aren't deliberately fiddling the figures. Yeah, that >> > would be correct. We're in the realm

Re: Pythonic infinite for loop?

2011-04-15 Thread Peter Otten
Chris Angelico wrote: > On Fri, Apr 15, 2011 at 6:25 PM, Peter Otten <__pete...@web.de> wrote: >> The initial data structure seems less than ideal. You might be able to >> replace it with a dictionary like >> >> {"Keyword": [value_for_keyword_1, value_for_keyword_2, ...]} >> >> if you try hard eno

Re: PYTHONPATH

2011-04-15 Thread Gabriel Genellina
En Fri, 15 Apr 2011 05:33:18 -0300, Algis Kabaila escribió: An elementary question that is bugging me, regarding sys.path values.sys.path can be altered easily, but the changes last for the current session only. I would like the changes to stay for several sessions. Is PYTHONPATH a system va

Re: Can you advice a Python library to query a lan subnet with SNMP and collect MAC addresses of nodes?

2011-04-15 Thread frankcui
On 04/15/2011 05:00 PM, Aldo Ceccarelli wrote: Hello All, in my specific problem I will be happy of a response where possible to: 1. distinguish different operating systems of answering nodes 2. collect responses of Wyse thin-clients with "Thin OS" to get node name and MAC address in particular

Re: PYTHONPATH

2011-04-15 Thread Algis Kabaila
On Friday 15 April 2011 19:21:12 Chris Rebert wrote: > On Fri, Apr 15, 2011 at 1:33 AM, Algis Kabaila wrote: > > Hi, > > >>snip.. > It is an environment variable: > http://en.wikipedia.org/wiki/Environment_variable > > Alternatively, you can use a .pth file to add directories to > the module se

Re: Can you advice a Python library to query a lan subnet with SNMP and collect MAC addresses of nodes?

2011-04-15 Thread Aldo Ceccarelli
On 15 Apr, 11:54, frankcui wrote: > On 04/15/2011 05:00 PM, Aldo Ceccarelli wrote:> Hello All, > > in my specific problem I will be happy of a response where possible > > to: > > > 1. distinguish different operating systems of answering nodes > > 2. collect responses of Wyse thin-clients with "Thi

http://DuplicateFilesDeleter.com - This software deletes duplicate files in media collection of any type

2011-04-15 Thread Max Loger
http://DuplicateFilesDeleter.com - find duplicates http://DuplicateFilesDeleter.com is an innovative tool that can recognize duplicate audio files even if they are stored in different file formats and not marked with ID3 tags. It will find fast all similar or exact duplicate audio files in a fold

Re: TextWrangler "run" command not working properly

2011-04-15 Thread Brian Blais
Hello Fabio You have two versions of 2.6 on your system. On Apr 15, 2011, at 4:51 AM, Fabio wrote: > I have the "built-in" Python2.5 which comes installed by "mother Apple". My OSX comes with 2.3, 2.5, and 2.6. :) These are under: /System/Library/Frameworks/Python.framework/Versions/ ^^

Re: Pythonic infinite for loop?

2011-04-15 Thread Steven D'Aprano
On Fri, 15 Apr 2011 18:32:23 +1000, Chris Angelico wrote: > On Fri, Apr 15, 2011 at 6:25 PM, Peter Otten <__pete...@web.de> wrote: >> The initial data structure seems less than ideal. You might be able to >> replace it with a dictionary like >> >> {"Keyword": [value_for_keyword_1, value_for_keywor

Re: Pythonic infinite for loop?

2011-04-15 Thread Steven D'Aprano
On Fri, 15 Apr 2011 13:58:22 +1000, Chris Angelico wrote: > The dictionary is potentially a lot larger than this particular set of > values (it's a mapping of header:value for a row of a user-provided CSV > file). Does this make a difference to the best option? (Currently I'm > looking at "likely"

Re: Pythonic infinite for loop?

2011-04-15 Thread Roy Smith
In article <4da83f8f$0$29986$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > for key in dct: > if key.startswith("Keyword"): > maxkey = max(maxkey, int(key[7:])) I would make that a little easier to read, and less prone to "Did I count correctly?" bugs with something

Re: Pythonic infinite for loop?

2011-04-15 Thread Ethan Furman
Chris Angelico wrote: lst=[] for i in xrange(1,1000): # arbitrary top, don't like this try: lst.append(parse_kwdlist(dct["Keyword%d"%i])) except KeyError: break Possibly overkill: import dbf table = dbf.from_csv("csvfile") # fields get names f0, f1, f2, ... table.rename_field

Re: Can you advice a Python library to query a lan subnet with SNMP and collect MAC addresses of nodes?

2011-04-15 Thread Verde Denim
On Fri, Apr 15, 2011 at 5:00 AM, Aldo Ceccarelli wrote: > Hello All, > in my specific problem I will be happy of a response where possible > to: > > 1. distinguish different operating systems of answering nodes > 2. collect responses of Wyse thin-clients with "Thin OS" to get node > name and MAC a

Re: Pythonic infinite for loop?

2011-04-15 Thread Chris Angelico
On Fri, Apr 15, 2011 at 10:52 PM, Steven D'Aprano wrote: > On Fri, 15 Apr 2011 13:58:22 +1000, Chris Angelico wrote: > >> The dictionary is potentially a lot larger than this particular set of >> values (it's a mapping of header:value for a row of a user-provided CSV >> file). Does this make a dif

Re: Pythonic infinite for loop?

2011-04-15 Thread Paul Rubin
Chris Angelico writes: > This whole code is inside a loop that we took, in smoke testing, to a > couple hundred million rows (I think), with the intention of having no > limit at all. So this might only look at 60-100 headers, but it will > be doing so in a tight loop. If you're talking about dat

Questions about GIL and web services from a n00b

2011-04-15 Thread Chris H
So I'm in a startup where we are considering using python as our primary development language for all the wonderful reasons you would expect. However, I've had a couple of things come up from mentors and other developers that is causing me to rethink whether python is the right choice. I hope

genfromtxt and comment identifier

2011-04-15 Thread simona bellavista
Hi All, I have a problem with reading data from a file using genfromtxt of numpy module. I have prepared a minimal example similar to the ones presented in http://docs.scipy.org/doc/numpy/user/basics.io.genfromtxt.html#splitting-the-lines-into-columns The script is import numpy as np from Stri

Re: Questions about GIL and web services from a n00b

2011-04-15 Thread Chris H
On 4/15/11 1:03 PM, Tim Wintle wrote: On Fri, 2011-04-15 at 12:33 -0400, Chris H wrote: 1. Are you sure you want to use python because threading is not good due to the Global Lock (GIL)? Is this really an issue for multi-threaded web services as seems to be indicated by the articles from a Goog

Re: Questions about GIL and web services from a n00b

2011-04-15 Thread Tim Wintle
On Fri, 2011-04-15 at 12:33 -0400, Chris H wrote: > > 1. Are you sure you want to use python because threading is not good > due to the Global Lock (GIL)? Is this really an issue for > multi-threaded web services as seems to be indicated by the articles > from a Google search? If not, how do you

Re: genfromtxt and comment identifier

2011-04-15 Thread Peter Otten
simona bellavista wrote: > Hi All, > > I have a problem with reading data from a file using genfromtxt of > numpy module. > > I have prepared a minimal example similar to the ones presented in > > http://docs.scipy.org/doc/numpy/user/basics.io.genfromtxt.html#splitting- the-lines-into-columns >

Re: Questions about GIL and web services from a n00b

2011-04-15 Thread Dan Stromberg
On Fri, Apr 15, 2011 at 9:33 AM, Chris H wrote: > 1. Are you sure you want to use python because threading is not good due to > the Global Lock (GIL)?  Is this really an issue for multi-threaded web > services as seems to be indicated by the articles from a Google search?  If > not, how do you av

Re: [Mac OSX] TextWrangler "run" command not working properly

2011-04-15 Thread Jason Swails
On Thu, Apr 14, 2011 at 1:52 PM, Fabio wrote: > Then, I started to use TexWrangler, and I wanted to use the "shebang" > menu, and "run" command. > I have the "#! first line" pointing to the 2.6 version. > It works fine, as long as I don't import the libraries, in which case it > casts an error sa

Can Python control Thuderbird?

2011-04-15 Thread marceepoo
I want to control Mozilla Thunderbird using Python. Does anyone know if that is that possible? I would like to use Python to save email attachments to a specific directory, depending on the name of the sender, content in the email, etc.--- and to rename the attachment file -- and to save the email

Is it possible to execute Python code from C++ without writing to a file?

2011-04-15 Thread Roger House
I'm a Python newbie who's been given a task requiring calls of Python code from a C++ program. I've tried various tutorials and dug into The Python/C API doc and the Extending and Embedding Python doc, but I haven't been able to answer this question: Is it possible in a C++ program to genera

Re: Is it possible to execute Python code from C++ without writing to a file?

2011-04-15 Thread Chris Angelico
On Sat, Apr 16, 2011 at 9:46 AM, Roger House wrote: > I'm a Python newbie who's been given a task requiring calls of Python code > from a C++ program.  I've tried various tutorials and dug into The Python/C > API doc and the Extending and Embedding Python doc, but I haven't been able > to answer t

Re: Questions about GIL and web services from a n00b

2011-04-15 Thread Raymond Hettinger
> > Is the limiting factor CPU? > > > If it isn't (i.e. you're blocking on IO to/from a web service) then the > > GIL won't get in your way. > > > If it is, then run as many parallel *processes* as you have cores/CPUs > > (assuming you're designing an application that can have multiple > > instance

Re: Questions about GIL and web services from a n00b

2011-04-15 Thread David Cournapeau
On Sat, Apr 16, 2011 at 10:05 AM, Raymond Hettinger wrote: >> > Is the limiting factor CPU? >> >> > If it isn't (i.e. you're blocking on IO to/from a web service) then the >> > GIL won't get in your way. >> >> > If it is, then run as many parallel *processes* as you have cores/CPUs >> > (assuming

Python IDE/text-editor

2011-04-15 Thread Alec Taylor
Good Afternoon, I'm looking for an IDE which offers syntax-highlighting, code-completion, tabs, an embedded interpreter and which is portable (for running from USB on Windows). Here's a mockup of the app I'm looking for: http://i52.tinypic.com/2uojswz.png Which would you recommend? Thanks in ad

Re: Python IDE/text-editor

2011-04-15 Thread Ben Finney
Alec Taylor writes: > I'm looking for an IDE which offers syntax-highlighting, > code-completion, tabs, an embedded interpreter and which is portable > (for running from USB on Windows). Either of Emacs http://www.gnu.org/software/emacs/> or Vim http://www.vim.org/> are excellent general-purpose

Re: Python IDE/text-editor

2011-04-15 Thread rusi
On Apr 16, 8:20 am, Alec Taylor wrote: > Good Afternoon, > > I'm looking for an IDE which offers syntax-highlighting, > code-completion, tabs, an embedded interpreter and which is portable > (for running from USB on Windows). > > Here's a mockup of the app I'm looking for:http://i52.tinypic.com/2u

Re: PYTHONPATH

2011-04-15 Thread harrismh777
Algis Kabaila wrote: Is PYTHONPATH a system variable that sets the path for several sessions and if so, where in the system is it? Do I need to create one for setting python path for several sessions? It can be, and there are lots of ways to accomplish what you want, some of which depends on t

Re: Egos, heartlessness, and limitations

2011-04-15 Thread Littlefield, Tyler
>And who pissed in Guido's punch bowl anyway? Why is he such an elitist >now? Why can he not come over once and a while and rub shoulders with http://www.youtube.com/watch?v=FMEe7JqBgvg -- http://mail.python.org/mailman/listinfo/python-list

Re: Free software versus software idea patents

2011-04-15 Thread harrismh777
CM wrote: What was criticized was your approach, which seemed counter-productive, and so much so that it seemed like you are "really" advocating FOR software patents by discrediting the position against them. Oh, the "thou protesteth too much" argument... ... well, I can only say that none of

Re: Python IDE/text-editor

2011-04-15 Thread TerrorBite Lion
On Apr 15, 11:20 pm, Alec Taylor wrote: > Good Afternoon, > > I'm looking for an IDE which offers syntax-highlighting, > code-completion, tabs, an embedded interpreter and which is portable > (for running from USB on Windows). > > Here's a mockup of the app I'm looking for:http://i52.tinypic.com/2

Re: [OT] Free software versus software idea patents

2011-04-15 Thread harrismh777
geremy condra wrote: > http://www.groklaw.net/articlebasic.php?story=2009151305785 > This is not a proof. This is an argument. There's a very big difference. To be clear, this article makes basically the same mistake you do- you assume that a program is exactly equivalent to its comp

Re: Python IDE/text-editor

2011-04-15 Thread John Bokma
Ben Finney writes: > Alec Taylor writes: > >> I'm looking for an IDE which offers syntax-highlighting, >> code-completion, tabs, an embedded interpreter and which is portable >> (for running from USB on Windows). > > Either of Emacs http://www.gnu.org/software/emacs/> or Vim > http://www.vim.org

Re: Python IDE/text-editor

2011-04-15 Thread Alec Taylor
Thanks, but non of the IDEs so far suggested have an embedded python interpreter AND tabs... a few of the editors (such as Editra) have really nice interfaces, however are missing the embedded interpreter... emacs having the opposite problem, missing tabs (also, selecting text with my mouse is some

Re: Python IDE/text-editor

2011-04-15 Thread harrismh777
Alec Taylor wrote: Please continue your recommendations. IDLE? (works for me) 3.2 is working much better for me this week... :) (thanks) kind regards, m harris -- http://mail.python.org/mailman/listinfo/python-list

Re: Python IDE/text-editor

2011-04-15 Thread CM
On Apr 16, 1:43 am, Alec Taylor wrote: > Thanks, but non of the IDEs so far suggested have an embedded python > interpreter AND tabs... a few of the editors (such as Editra) have > really nice interfaces, however are missing the embedded > interpreter... emacs having the opposite problem, missing

Re: [OT] Free software versus software idea patents

2011-04-15 Thread geremy condra
On Fri, Apr 15, 2011 at 10:21 PM, harrismh777 wrote: This looks to me like an application of the troll motto "if you can't dazzle them with brilliance, baffle them with bull". It certainly does nothing to prove your claim, despite clearly attempting to word-salad your way through an argument.

Re: Python IDE/text-editor

2011-04-15 Thread Ian Kelly
On Fri, Apr 15, 2011 at 9:20 PM, Alec Taylor wrote: > Good Afternoon, > > I'm looking for an IDE which offers syntax-highlighting, > code-completion, tabs, an embedded interpreter and which is portable > (for running from USB on Windows). > > Here's a mockup of the app I'm looking for: http://i52.