Re: Is python not good enough?

2010-01-13 Thread tanix
In article , Dennis Lee Bieber wrote: >On Wed, 13 Jan 2010 00:53:19 -0800 (PST), "johan.san...@gmail.com" > declaimed the following in >gmane.comp.python.general: >> GoPython i think would be neat. > >As long as it doesn't get called "GoPy" (too easy to pronounce as >"goopy") :--} You

Re: Sort list of dictionaries by key (case insensitive)

2010-01-13 Thread Nico Grubert
http://wiki.python.org/moin/HowTo/Sorting#Topicstobecovered Works fine. Thanks a lot for your help, Stefan. Regards Nico -- http://mail.python.org/mailman/listinfo/python-list

A simple-to-use sound file writer

2010-01-13 Thread Alf P. Steinbach
Just as a contribution, since someone hinted that I haven't really contributed much to the Python community. The [simple_sound] code will probably go into my ch 3 at http://tinyurl.com/programmingbookP3>, but sans sine wave generation since I haven't yet discussed trig functions, and maybe /wit

Re: Trying to run a sudo command from script

2010-01-13 Thread Aahz
In article , =?ISO-8859-1?Q?Paul_K=F6lle?= wrote: > >If you don't use shell=True you have to provide the full path to >commands (and split command and parameters as you do). Are you sure? Try this: print Popen(['ls'], stdin=PIPE, stdout=PIPE).communicate()[0] -- Aahz (a...@pythoncraft.com)

Re: Those two controversial 2nd & 3rd paragraphs of my ch 1

2010-01-13 Thread Gabriel Genellina
En Wed, 13 Jan 2010 17:11:18 -0300, Daniel Fetchinson escribió: Again, django has been ported to python 3, that's fine, everybody acknowledges that, but it's not the case that one code base works with both python versions. Well, if the port is done via 2to3, you can install the same code ba

Re: parsing an Excel formula with the re module

2010-01-13 Thread Gabriel Genellina
En Wed, 13 Jan 2010 05:15:52 -0300, Paul McGuire escribió: vsoler wrote: > Hence, I need toparseExcel formulas. Can I do it by means only of re > (regular expressions)? This might give the OP a running start: from pyparsing import (CaselessKeyword, Suppress, ... Did you build those parsing

Re: memory problem with list creation

2010-01-13 Thread Steven D'Aprano
On Thu, 14 Jan 2010 02:03:52 +, Steven D'Aprano wrote: > Again, the technique you are using does a pointless amount of extra > work. The values in the xrange object are already floats, calling float > on them just wastes time. Er what? Sorry, please ignore that. This is completely untrue --

Re: memory problem with list creation

2010-01-13 Thread Steven D'Aprano
On Wed, 13 Jan 2010 06:24:04 -0800, Allard Warrink wrote: > Within a python script I'm using a couple of different lists containing > a large number of floats (+8M). The execution of this script fails > because of an memory error (insufficient memory). I thought this was > strange because I delete

Re: Python and Tkinter Programming by John Grayson

2010-01-13 Thread Lord Eldritch
Peter wrote: > provides in his book (I used it once for my first GUI, but these days > use Pmw more for my GUIs). > Maybe I'm wrong, but for me, it is THE Tkinter reference. I would probably choose another organization of the book, but I am not aware of a better, more complete treatise about. E

Re: How to test a URL request in a "while True" loop

2010-01-13 Thread Aahz
In article , Aahz wrote: >In article , >Philip Semanchuk wrote: >> >>While I don't fully understand what you're trying to accomplish by >>changing the URL to google.com after 3 iterations, I suspect that some >>of your trouble comes from using "while True". Your code would be >>clearer if

Re: How to test a URL request in a "while True" loop

2010-01-13 Thread Aahz
In article , Philip Semanchuk wrote: > >While I don't fully understand what you're trying to accomplish by >changing the URL to google.com after 3 iterations, I suspect that some >of your trouble comes from using "while True". Your code would be >clearer if the while clause actually stated

heapq._siftdown / decrease-key support?

2010-01-13 Thread Joshua Bronson
I recently implemented A* search in Python using the heapq module and in my first pass, to accomplish the decrease-key operation I resorted to doing a linear scan of the list to find the position of the key in the heap, and then calling the private undocumented method heapq._siftdown at this positi

Re: Author of a Python Success Story Needs a Job!

2010-01-13 Thread Phlip
Andrew Jonathan Fine wrote: I was laid off by Honeywell several months after I had made my presentation in the 2005 Python Conference. Since then I have been unable to find work either as a software engineer or in any other capacity, even at service jobs. I've sent resumes and have been consi

Re: Those two controversial 2nd & 3rd paragraphs of my ch 1

2010-01-13 Thread Alf P. Steinbach
* Daniel Fetchinson: Nobody is deliberately trying to keep people from porting! I think you misunderstand what is being said, these two statements are very different: (1) single code base working on both python versions (2) creating a second code from a code so that the second code works with py

Re: Bugs in CPython 3.1.1 [wave.py]

2010-01-13 Thread Alf P. Steinbach
* Alf P. Steinbach: * Steve Holden: Alf P. Steinbach wrote: * Steven D'Aprano: Nobody is trying to understate the complexity of writing a large application that supports both 2.6 and 3.x, or of taking an existing library written for 2.5 and upgrading it to support 3.1. But the magnitude of the

Re: Undo/Redo in PyQt

2010-01-13 Thread David Boddie
On Wednesday 13 January 2010 02:20, Zabin wrote: > I am trying to implement the undo and redo facility in pyqt. I have > gone through some sites and was wondering whether iyou always need to > create subclasses and their definitions for the undo/redo action. My > program currently has a single win

Re: Bugs in CPython 3.1.1 [wave.py]

2010-01-13 Thread Alf P. Steinbach
* Steve Holden: Alf P. Steinbach wrote: * Steven D'Aprano: Nobody is trying to understate the complexity of writing a large application that supports both 2.6 and 3.x, or of taking an existing library written for 2.5 and upgrading it to support 3.1. But the magnitude of these tasks is no greate

Re: os.system function

2010-01-13 Thread r0g
Lie Ryan wrote: > On 01/13/10 04:59, r0g wrote: >> so you may want to look into pythons core GUI library, TKL. > > I know Tk and Tcl has been close since their childhood; did they get > married too? Whoops... yes Tk/Tcl, it seems they had become one in my head only! :) Roger. -- http://mail.py

Re: interactive terminal in Ubuntu Linux : libreadline5-dev works only in Python 2.6 not 3.1

2010-01-13 Thread Lee Harr
>> When you first had this problem, was python3 installed from >> source, or was it from the Ubuntu repository? > Over a month ago I downloaded the tarball Python-3.1.1 from > the python website.  Then the Synaptic Package Manager did not > contain this ( latest ) version. There is already pytho

Re: PyQt event recognition

2010-01-13 Thread Zabin
On Jan 14, 10:22 am, Jonathan Gardner wrote: > On Jan 13, 12:21 pm, Zabin wrote: > > > On Jan 14, 9:00 am, Zabin wrote: > > > > I am a new pyqt programmer. I have a tab widget with lots of line > > > edits, radiobuttons and combo boxes. I want to trigger a single sub > > > the moment any one of

paypal django

2010-01-13 Thread ozgur vatansever
Hi, I coded a python interface of a paypal nvp API for django. If you are interested, you can check it out. http://code.google.com/p/django-paypal-driver/ Happy coding. -- http://mail.python.org/mailman/listinfo/python-list

Re: PyQt event recognition

2010-01-13 Thread Jonathan Gardner
On Jan 13, 12:21 pm, Zabin wrote: > On Jan 14, 9:00 am, Zabin wrote: > > > I am a new pyqt programmer. I have a tab widget with lots of line > > edits, radiobuttons and combo boxes. I want to trigger a single sub > > the moment any one of these widgets listed are modified. I tried using > > the c

Re: Author of a Python Success Story Needs a Job!

2010-01-13 Thread Aahz
In article , Andrew Jonathan Fine wrote: > >I was laid off by Honeywell several months after I had made my >presentation in the 2005 Python Conference. > >Since then I have been unable to find work either as a software >engineer or in any other capacity, even at service jobs. I've sent >resumes

Re: A question about Python versions

2010-01-13 Thread Gib Bogle
Terry Reedy wrote: On 1/13/2010 1:09 AM, Gib Bogle wrote: I am learning Python, and using PyQt to develop a GUI that will be used to run a Fortran program on Windows, Linux and Mac OS X (I think Python is great, btw). Without thinking about it I downloaded and started working with a fairly recen

Re: A question about Python versions

2010-01-13 Thread Gib Bogle
Sridhar Ratnakumar wrote: On 1/12/2010 10:09 PM, Gib Bogle wrote: I am learning Python, and using PyQt to develop a GUI that will be used to run a Fortran program on Windows, Linux and Mac OS X (I think Python is great, btw). Without thinking about it I downloaded and started working with a fair

Re: Getting access to the process table from python?

2010-01-13 Thread Terry Reedy
On 1/13/2010 1:41 PM, Roy Smith wrote: I need to get information about what processes are running on a box. Right now, I'm interested in Solaris and Linux, but eventually probably other systems too. I need to know things like the pid, command line, CPU time, when the process started running, and

Re: How to iterate the input over a particular size?

2010-01-13 Thread Aahz
In article <46a5e979-7a87-49ee-ac7e-71d3a235d...@e37g2000yqn.googlegroups.com>, joy99 wrote: > >input_string=raw_input("PRINT A STRING:") >string_to_word=input_string.split() >len_word_list=len(string_to_word) >if len_word_list>9: > rest_words=string_to_word[9:] > len_rest

Re: Python and Tkinter Programming by John Grayson

2010-01-13 Thread Peter
On Jan 13, 11:19 am, Ethan Furman wrote: > Greetings! > > I am hoping to acquire a book on Python and Tkinter, and found this one. >   However, it was published in 2000 for Python 1.52... > > Can somebody who has this book comment its continued relevance?  Is it > still useful for Python 2.5 and T

Re: Those two controversial 2nd & 3rd paragraphs of my ch 1

2010-01-13 Thread Terry Reedy
On 1/13/2010 11:30 AM, Daniel Fetchinson wrote: Example? Just to be clear I'm looking for an example where one given code runs on python 2 and 3 unmodified. I think django and cheetah doesn't count because they simply take their python 2 code, run it through 2to3 which gives them a python 3 code

Re: Getting access to the process table from python?

2010-01-13 Thread John Gabriele
On Jan 13, 1:41 pm, Roy Smith wrote: > I need to get information about what processes are running on a box. > Right now, I'm interested in Solaris and Linux, but eventually > probably other systems too.  I need to know things like the pid, > command line, CPU time, when the process started running

Re: Simple distributed example for learning purposes?

2010-01-13 Thread Aahz
In article , Tim Golden wrote: > >I'm trying to come up with something which will illustrate the >usefulness of a distributed processing model. Since I may not be using >the term "distributed" exactly, my criteria are: Distributed spider with firewall that limits network I/O per computer (the fi

Re: PyQt event recognition

2010-01-13 Thread Zabin
On Jan 14, 9:00 am, Zabin wrote: > Hey Everyone! > > I am a new pyqt programmer. I have a tab widget with lots of line > edits, radiobuttons and combo boxes. I want to trigger a single sub > the moment any one of these widgets listed are modified. I tried using > the clicked signal- but it doesnt

Re: Compiling Python 2.7a2 on AIX6.1 (also pycrypto)

2010-01-13 Thread Terry Reedy
On 1/13/2010 6:13 AM, knipknap wrote: Hi, I have just successfully compiled Python 2.7a2 on AIX6.1, using the IBM XL compiler (no gcc). I am documenting this here in case somebody needs it: ### First, I installed the following dependencies: 1. readline-6.1; 2. tcl8.4.19/unix/ 3. tk8.4.19/u

Re: Bugs in CPython 3.1.1 [wave.py]

2010-01-13 Thread Terry Reedy
On 1/13/2010 3:44 AM, Steven D'Aprano wrote: On Wed, 13 Jan 2010 09:34:55 +0100, Alf P. Steinbach wrote: Would it be better to say that it's "hard" or "very hard" or "impractical for the novice"? Yes, but ... I don't even know why you feel the need to discuss 2.x in a book that's about 3

Re: Getting access to the process table from python?

2010-01-13 Thread Aahz
In article <08fc5739-1dd9-402f-84ba-d9f72f48d...@j4g2000yqe.googlegroups.com>, Roy Smith wrote: > >I need to get information about what processes are running on a box. >Right now, I'm interested in Solaris and Linux, but eventually >probably other systems too. I need to know things like the pid,

Re: Those two controversial 2nd & 3rd paragraphs of my ch 1

2010-01-13 Thread Daniel Fetchinson
>> Again, django has been ported to python 3, that's fine, everybody >> acknowledges that, but it's not the case that one code base works with >> both python versions. > > Well, if the port is done via 2to3, you can install the same code base in > Python 2 and Python 3, and the distutils install me

Re: Those two controversial 2nd & 3rd paragraphs of my ch 1

2010-01-13 Thread Daniel Fetchinson
>> One code base of cheetah works under python 2 and 3? I doubt it, but I >> could be wrong. What I can easily imagine is that somebody ported >> cheetah to python 3. In this case there are two code bases, one for >> python 2 and another for python 3. So it's not the same program that >> runs under

Re: Join a thread and get the return value of a function

2010-01-13 Thread Aahz
In article <4b33b0c...@dnews.tpgi.com.au>, Lie Ryan wrote: >On 12/25/2009 2:02 AM, mattia wrote: >> Il Fri, 25 Dec 2009 00:35:55 +1100, Lie Ryan ha scritto: >> >>> On 12/25/2009 12:23 AM, mattia wrote: Hi all, is there a way in python to get back the value of the function passed to a th

PyQt event recognition

2010-01-13 Thread Zabin
Hey Everyone! I am a new pyqt programmer. I have a tab widget with lots of line edits, radiobuttons and combo boxes. I want to trigger a single sub the moment any one of these widgets listed are modified. I tried using the clicked signal- but it doesnt seem to work. Any suggestion will be much app

Re: Those two controversial 2nd & 3rd paragraphs of my ch 1

2010-01-13 Thread Steve Holden
Daniel Fetchinson wrote: >>> Also, I would replace >>> >>> "in practice it’s very hard to create programs" >>> >>> with >>> >>> "in practice it’s very hard to create complex programs" >>> >>> because for small programs it's very possible to write code that will >>> work with both python 2 and 3. Th

Intra-package C extensions with freeze.py

2010-01-13 Thread Pascal Chambon
Hello everyone Some times ago, I've had unexpected problems while trying to freeze some scripts into a standalone executable with the "freeze.py" script. I had already done it : normally, you simply freeze pure python modules into a standalone executable, you package it along with python extens

Django (and Pylons) HTML Form Objects & Arrays

2010-01-13 Thread AJ ONeal
Do Django and Pylons use templates which map forms in the php / ruby manner (generally speaking)? AJ ONeal (317) 426-6525 -- http://mail.python.org/mailman/listinfo/python-list

Re: dict's as dict's key.

2010-01-13 Thread Peter Otten
Albert van der Horst wrote: > I have a type of objects that have complicated enough properties > to warrant a special class for its type. > The class has built in dictionary for all the properties. > > Something along the line of > a = ctype({"poker":True}) > b = ctype({"footbal":True, "gender":"

Re: dict's as dict's key.

2010-01-13 Thread Arnaud Delobelle
Albert van der Horst writes: > I have a type of objects that have complicated enough properties > to warrant a special class for its type. > The class has built in dictionary for all the properties. > > Something along the line of > a = ctype({"poker":True}) > b = ctype({"footbal":True, "gender":

Re: Bugs in CPython 3.1.1 [wave.py]

2010-01-13 Thread Steve Holden
Alf P. Steinbach wrote: > * Steven D'Aprano: >> >> Nobody is trying to understate the complexity of writing a large >> application that supports both 2.6 and 3.x, or of taking an existing >> library written for 2.5 and upgrading it to support 3.1. But the >> magnitude of these tasks is no greater (

Re: Those two controversial 2nd & 3rd paragraphs of my ch 1

2010-01-13 Thread Stefan Behnel
Daniel Fetchinson, 13.01.2010 17:30: Again, django has been ported to python 3, that's fine, everybody acknowledges that, but it's not the case that one code base works with both python versions. Well, if the port is done via 2to3, you can install the same code base in Python 2 and Python 3, a

Getting access to the process table from python?

2010-01-13 Thread Roy Smith
I need to get information about what processes are running on a box. Right now, I'm interested in Solaris and Linux, but eventually probably other systems too. I need to know things like the pid, command line, CPU time, when the process started running, and owner. Has anybody written a module to

dict's as dict's key.

2010-01-13 Thread Albert van der Horst
I have a type of objects that have complicated enough properties to warrant a special class for its type. The class has built in dictionary for all the properties. Something along the line of a = ctype({"poker":True}) b = ctype({"footbal":True, "gender":"m"}) c = ctype({"chess":True, "residence":"

Re: Compiling Python 2.7a2 on AIX6.1 (also pycrypto)

2010-01-13 Thread Josh Volchko
On Jan 13, 6:13 am, knipknap wrote: > Hi, > > I have just successfully compiled Python 2.7a2 on AIX6.1, using the > IBM XL compiler (no gcc). I am documenting this here in case somebody > needs it: > > ### > First, I installed the following dependencies: > > 1. readline-6.1; > 2. tcl8.4.19/uni

Re: Those two controversial 2nd & 3rd paragraphs of my ch 1

2010-01-13 Thread André
On Jan 13, 12:30 pm, Daniel Fetchinson wrote: > > One code base of cheetah works under python 2 and 3? I doubt it, but I > could be wrong. What I can easily imagine is that somebody ported > cheetah to python 3. In this case there are two code bases, one for > python 2 and another for python 3. S

Re: Do I have to use threads?

2010-01-13 Thread Tom
On Jan 7, 5:38 pm, MRAB wrote: > Jorgen Grahn wrote: > > On Thu, 2010-01-07, Marco Salden wrote: > >> On Jan 6, 5:36 am, Philip Semanchuk wrote: > >>> On Jan 5, 2010, at 11:26 PM, aditya shukla wrote: > > Hello people, > I have 5 directories corresponding 5  different urls .I want to  

Re: Those two controversial 2nd & 3rd paragraphs of my ch 1

2010-01-13 Thread Daniel Fetchinson
>> Also, I would replace >> >> "in practice it’s very hard to create programs" >> >> with >> >> "in practice it’s very hard to create complex programs" >> >> because for small programs it's very possible to write code that will >> work with both python 2 and 3. The question is of course what progra

Re: Code Generator written in python

2010-01-13 Thread Gabriel Genellina
En Wed, 13 Jan 2010 13:09:38 -0300, Arnaud Delobelle escribió: nyoka writes: Can someone help me with sample python code for a code generator Sure, here are some example of self-evaluating python objects, i.e. for each v below, v == eval(v) I'm quite proud of the last one.

Re: memory problem with list creation

2010-01-13 Thread Gabriel Genellina
En Wed, 13 Jan 2010 11:24:04 -0300, Allard Warrink escribió: Within a python script I'm using a couple of different lists containing a large number of floats (+8M). The execution of this script fails because of an memory error (insufficient memory). I thought this was strange because I delete

Re: Code Generator written in python

2010-01-13 Thread Arnaud Delobelle
nyoka writes: > Can someone help me with sample python code for a code generator Sure, here are some example of self-evaluating python objects, i.e. for each v below, v == eval(v) I'm quite proud of the last one. v = (lambda x:x%('"''""'+x+'"''""'))("""(lambda x:x%%('"''""'+x+'"''""'

Re: Code Generator written in python

2010-01-13 Thread Peter Otten
nyoka wrote: > Can someone help me with sample python code for a code generator >>> print "print" print Seriously, you have to provide more information if you want a meaningful answer. If the generated code is Python, too, then the advice is most likely that you don't need to generate any code

Re: Code Generator written in python

2010-01-13 Thread Stefan Behnel
nyoka, 13.01.2010 16:48: Can someone help me with sample python code for a code generator Such as Cheetah? http://www.cheetahtemplate.org/ BTW, you might want to be more specific about your problem at hand. Code generation is a rarely used technique in Python. Most of the time, it's more ma

Code Generator written in python

2010-01-13 Thread nyoka
Can someone help me with sample python code for a code generator -- http://mail.python.org/mailman/listinfo/python-list

Re: Those two controversial 2nd & 3rd paragraphs of my ch 1

2010-01-13 Thread Stefan Behnel
Daniel Fetchinson, 13.01.2010 16:23: Also, I would replace "in practice it’s very hard to create programs" with "in practice it’s very hard to create complex programs" because for small programs it's very possible to write code that will work with both python 2 and 3. The question is of cours

Re: Sort list of dictionaries by key (case insensitive)

2010-01-13 Thread Peter Otten
Nico Grubert wrote: > Thanks a lot Stefan & Peter. > > I'm almost there (except sorting of umlauts does not work yet). > > > import locale locale.setlocale(locale.LC_ALL, "") > def sorted(items, key): > decorated = [(key(item), index, item) for index, item in >enumera

Re: Is python not good enough?

2010-01-13 Thread ikuta liu
On 1月13日, 上午7時55分, a...@pythoncraft.com (Aahz) wrote: > In article <1b42700d-139a-4653-8669-d4ee2fc48...@r5g2000yqb.googlegroups.com>, > ikuta liu   wrote: > > > > >Is python not good enough? for google, enhance python performance is > >the good way better then choose build Go language? > > It is n

Re: Sort list of dictionaries by key (case insensitive)

2010-01-13 Thread Stefan Behnel
Nico Grubert, 13.01.2010 16:18: print sorted(items, key=lambda d: locale.strxfrm(d.get('title'))) -> [{'id': 2, 'title': 'The Storm'}, {'id': 4, 'title': 'The thunder'}, {'id': 3, 'title': 'the bible'}, {'id': 1, 'title': 'the \xc4hnlich'}] The entry with the umlaut is the last item in but ac

Re: Those two controversial 2nd & 3rd paragraphs of my ch 1

2010-01-13 Thread Daniel Fetchinson
>> As of this writing two main variants of the Python language are in use, >> namely Python 2.x and Python 3.x (versions 3.0 and greater). Mostly >> they’re the same but the effect of e.g. the / division operator changed in >> 3.0, so in practice it’s very hard to create programs that work the sam

Re: Sort list of dictionaries by key (case insensitive)

2010-01-13 Thread Nico Grubert
Thanks a lot Stefan & Peter. I'm almost there (except sorting of umlauts does not work yet). import locale def sorted(items, key): decorated = [(key(item), index, item) for index, item in enumerate(items)] decorated.sort() return [item[2] for item in decorated] i

Re: memory problem with list creation

2010-01-13 Thread Stefan Behnel
Allard Warrink, 13.01.2010 15:24: so I did some investigation on the memory use of the script. I found out that when i populated the lists with floats using a for ... in range() loop a lot of overhead memory is used and that this memory is not freed after populating the list and is also not freed

Python-URL! - weekly Python news and links (Jan 13)

2010-01-13 Thread Gabriel Genellina
QOTW: "... if I want to know something new (be it a computer language or anything else, such as economics, history, science) I skip the introductory material and go directly to the discussion, to the issues. This is for me the most effective and interesting way of learning something new. And if th

Re: Those two controversial 2nd & 3rd paragraphs of my ch 1

2010-01-13 Thread Peter Otten
Alf P. Steinbach wrote: > As of this writing two main variants of the Python language are in use, > namely Python 2.x and Python 3.x (versions 3.0 and greater). Mostly > they’re the same but the effect of e.g. the / division operator changed in > 3.0, so in practice it’s very hard to create progr

Re: BeautifulSoup

2010-01-13 Thread Rolando Espinoza La Fuente
Hi, Also you can check a high-level framework for scrapping: http://scrapy.org/ In their docs includes an example of extracting torrents data from mininova http://doc.scrapy.org/intro/overview.html You will need to understand regular expressions, xpath expressions, callbacks, etc. In the faq exp

Re: install exe in virtualenv --no-site-packages

2010-01-13 Thread Jim Pharis
Solved this by copying the pywin32.pth file into my virtualenv site-packages and editing the file to point to the path. On Tue, Jan 12, 2010 at 5:35 PM, Jim Pharis wrote: > How do I install an exe in a sandboxed virtualenv that's been setup with no > site packages? The package I'm trying to inst

Those two controversial 2nd & 3rd paragraphs of my ch 1

2010-01-13 Thread Alf P. Steinbach
Referring to http://tinyurl.com/programmingbookP3> Due to especially Steven D'Aprano's comments I've replaced "hopeless" with "very hard" in paragraph 1 of section 1.1 -- I know he'll disagree with that also but I think any more downplaying of the difficulties would be misleading. According

Re: memory problem with list creation

2010-01-13 Thread Stefan Behnel
Allard Warrink, 13.01.2010 15:24: I found out that when i populated the lists with floats using a for ... in range() loop a lot of overhead memory is used Note that range() returns a list in Python 2.x. For iteration, use xrange(), or switch to Python 3 where range() returns an iterable. Ste

memory problem with list creation

2010-01-13 Thread Allard Warrink
Within a python script I'm using a couple of different lists containing a large number of floats (+8M). The execution of this script fails because of an memory error (insufficient memory). I thought this was strange because I delete all lists that are not longer necessary directly and my workstatio

Re: os.system function

2010-01-13 Thread Lie Ryan
On 01/13/10 04:59, r0g wrote: > so you may want to look into pythons core GUI library, TKL. I know Tk and Tcl has been close since their childhood; did they get married too? -- http://mail.python.org/mailman/listinfo/python-list

Re: BeautifulSoup

2010-01-13 Thread Peter Otten
yamamoto wrote: > Hi, > I am new to Python. I'd like to extract "a" tag from a website by > using "beautifulsoup" module. > but it doesnt work! > > //sample.py > > from BeautifulSoup import BeautifulSoup as bs > import urllib > url="http://www.d-addicts.com/forum/torrents.php"; > doc=urllib.urlo

Re: Where's a DOM builder that uses the Builder Pattern to ... build DOMs?

2010-01-13 Thread Stefan Behnel
Phlip, 07.01.2010 17:44: On Jan 7, 5:36 am, Stefan Behnel wrote: Well, then note that there are tons of ways to generate XML with Python, including the one I pointed you to. from lxml.html import builder as E xml = E.foo() All I want is "", but I get "AttributeError: 'module

BeautifulSoup

2010-01-13 Thread yamamoto
Hi, I am new to Python. I'd like to extract "a" tag from a website by using "beautifulsoup" module. but it doesnt work! //sample.py from BeautifulSoup import BeautifulSoup as bs import urllib url="http://www.d-addicts.com/forum/torrents.php"; doc=urllib.urlopen(url).read() soup=bs(doc) result=sou

Re: Sort list of dictionaries by key (case insensitive)

2010-01-13 Thread Stefan Behnel
Peter Otten, 13.01.2010 13:25: >>> items = "Atem Äther ähnlich anders".split() >>> print " ".join(sorted(items, key=lambda s: s.lower())) If you can make sure that 's' is either always a byte string or always a unicode string (which is good programming practice anyway), an unbound method can

Re: Sort list of dictionaries by key (case insensitive)

2010-01-13 Thread Peter Otten
Nico Grubert wrote: >> Er, that should have been mylist.sort(key = lambda d: >> d['title'].lower()) of course. > > > Thanks a lot for the tip, chris. > Unfortunately, I only have Python 2.3.5 installed and can't upgrade to > 2.4 due to an underliying application server. > > In python 2.3 the '

Re: Sort list of dictionaries by key (case insensitive)

2010-01-13 Thread Nico Grubert
Er, that should have been mylist.sort(key = lambda d: d['title'].lower()) of course. Thanks a lot for the tip, chris. Unfortunately, I only have Python 2.3.5 installed and can't upgrade to 2.4 due to an underliying application server. In python 2.3 the 'sort()' function does not excepts a

Compiling Python 2.7a2 on AIX6.1 (also pycrypto)

2010-01-13 Thread knipknap
Hi, I have just successfully compiled Python 2.7a2 on AIX6.1, using the IBM XL compiler (no gcc). I am documenting this here in case somebody needs it: ### First, I installed the following dependencies: 1. readline-6.1; 2. tcl8.4.19/unix/ 3. tk8.4.19/unix/ 4. zlib-1.2.3 All of these compile

Re: Sort list of dictionaries by key (case insensitive)

2010-01-13 Thread Florian Diesch
Nico Grubert writes: > Hi there > > I have the following list 'mylist' that contains some dictionaries: > > mylist = [{'title':'the Fog', 'id':1}, > {'title':'The Storm', 'id':2}, > {'title':'the bible', 'id':3}, > {'title':'The thunder', 'id':4} > ] > > How

Re: Sort list of dictionaries by key (case insensitive)

2010-01-13 Thread Chris Rebert
On Wed, Jan 13, 2010 at 2:41 AM, Chris Rebert wrote: > On Tue, Jan 12, 2010 at 11:45 PM, Nico Grubert wrote: >> Hi there >> >> I have the following list 'mylist' that contains some dictionaries: >> >> mylist = [{'title':'the Fog', 'id':1}, >>          {'title':'The Storm', 'id':2}, >>          {'

Re: Sort list of dictionaries by key (case insensitive)

2010-01-13 Thread Peter Otten
Nico Grubert wrote: > I have the following list 'mylist' that contains some dictionaries: > > mylist = [{'title':'the Fog', 'id':1}, >{'title':'The Storm', 'id':2}, >{'title':'the bible', 'id':3}, >{'title':'The thunder', 'id':4} > ] > > How I can so

Re: Sort list of dictionaries by key (case insensitive)

2010-01-13 Thread Chris Rebert
On Tue, Jan 12, 2010 at 11:45 PM, Nico Grubert wrote: > Hi there > > I have the following list 'mylist' that contains some dictionaries: > > mylist = [{'title':'the Fog', 'id':1}, >          {'title':'The Storm', 'id':2}, >          {'title':'the bible', 'id':3}, >          {'title':'The thunder',

Re: Bugs in CPython 3.1.1 [wave.py]

2010-01-13 Thread Stefan Behnel
Terry Reedy, 13.01.2010 04:40: What might be changed more easily is to accept a report but impound it until the confirmation reply. Being able to spit out what one has to say while it is still fresh in the mind should make the email wait more tolerable. What do you think? Sounds like a very g

Sort list of dictionaries by key (case insensitive)

2010-01-13 Thread Nico Grubert
Hi there I have the following list 'mylist' that contains some dictionaries: mylist = [{'title':'the Fog', 'id':1}, {'title':'The Storm', 'id':2}, {'title':'the bible', 'id':3}, {'title':'The thunder', 'id':4} ] How I can sort (case insensitive) the list b

Re: parsing an Excel formula with the re module

2010-01-13 Thread Chris Withers
John Machin wrote: The OP was planning to dig the formula text out using COM then parse the formula text looking for cell references and appeared to have a rather simplistic view of the ease of parsing Excel formula text -- that's why I pointed him at those facilities (existing, released, prove

Re: Is python not good enough?

2010-01-13 Thread Jonathan Hartley
On Jan 13, 9:06 am, ta...@mongo.net (tanix) wrote: > Well, as soon as they restore the braces to identify the code > blocks and provide the functionality of advanced statically > type languages, such as threads, async processing, all synchronization > primitives, garbage collection, events and GUI,

Re: usage of .pth files

2010-01-13 Thread Gabriel Genellina
En Wed, 13 Jan 2010 05:01:41 -0300, swapnil escribió: Python's documentation (http://docs.python.org/install/ index.html#modifying-python-s-search-path) states that we can add more locations to python's module search path by "add a path configuration file to a directory that’s already on Pyth

Re: Is python not good enough?

2010-01-13 Thread Stefan Behnel
tanix, 13.01.2010 10:06: Well, as soon as they restore the braces to identify the code blocks and provide the functionality of advanced statically type languages, such as threads, async processing, all synchronization primitives, garbage collection, events and GUI, i'd be willing to switch to Pyt

Re: Is python not good enough?

2010-01-13 Thread Chris Rebert
On Wed, Jan 13, 2010 at 1:06 AM, tanix wrote: > In article > <53ec94c0-dbdd-4901-a46b-d7faee121...@j14g2000yqm.googlegroups.com>, > "johan.san...@gmail.com" wrote: >>On Jan 13, 12:55=A0am, a...@pythoncraft.com (Aahz) wrote: >>> In article <1b42700d-139a-4653-8669-d4ee2fc48...@r5g2000yqb.googleg

Re: Is python not good enough?

2010-01-13 Thread tanix
In article <53ec94c0-dbdd-4901-a46b-d7faee121...@j14g2000yqm.googlegroups.com>, "johan.san...@gmail.com" wrote: >On Jan 13, 12:55=A0am, a...@pythoncraft.com (Aahz) wrote: >> In article <1b42700d-139a-4653-8669-d4ee2fc48...@r5g2000yqb.googlegroups.= >com>, >> ikuta liu =A0 wrote: >> >> >> >> >Is p

Re: Bugs in CPython 3.1.1 [wave.py]

2010-01-13 Thread Lie Ryan
Alf P. Steinbach wrote: > * Stefan Behnel: >> Alf P. Steinbach, 13.01.2010 06:39: >>> * Steven D'Aprano: On Tue, 12 Jan 2010 23:42:28 +0100, Alf P. Steinbach wrote: > It is hopeless, especially for a newbie, to create correct Python > 2.x+3.x compatible code, except totally trivial stu

Re: get back my simple little string after re search and replace

2010-01-13 Thread Gabriel Genellina
En Wed, 13 Jan 2010 02:12:31 -0300, Gontrand Trudau escribió: I have read the python doc pretty much, played around with python code, but unable to get back my "string" after made my replacement with python RE Here my string : ['em...@msn.com ;em...@ms

Re: Bugs in CPython 3.1.1 [wave.py]

2010-01-13 Thread Alf P. Steinbach
* Steven D'Aprano: On Wed, 13 Jan 2010 06:55:27 +0100, Alf P. Steinbach wrote: * Steven D'Aprano: On Tue, 12 Jan 2010 23:47:31 +0100, Alf P. Steinbach wrote: PS: Next time it would have helped to include a URL to the issue. http://bugs.python.org/issue7681 FYI there is already some

Re: Is python not good enough?

2010-01-13 Thread johan.san...@gmail.com
On Jan 13, 12:55 am, a...@pythoncraft.com (Aahz) wrote: > In article <1b42700d-139a-4653-8669-d4ee2fc48...@r5g2000yqb.googlegroups.com>, > ikuta liu   wrote: > > > > >Is python not good enough? for google, enhance python performance is > >the good way better then choose build Go language? > > It is

Re: Confusion about scan_code in modulefinder.py (in python 2.6)

2010-01-13 Thread Gabriel Genellina
En Tue, 12 Jan 2010 23:15:17 -0300, Brock Pytlik escribió: I've been working with the modulefinder.py code recently and I've come across a bit of code I'm not grasping. In the scan_code function, there are the following lines: if sys.version_info >= (2, 5):

Re: Bugs in CPython 3.1.1 [wave.py]

2010-01-13 Thread Steven D'Aprano
On Wed, 13 Jan 2010 09:34:55 +0100, Alf P. Steinbach wrote: > * Steven D'Aprano: >> >> Nobody is trying to understate the complexity of writing a large >> application that supports both 2.6 and 3.x, or of taking an existing >> library written for 2.5 and upgrading it to support 3.1. But the >> ma

Re: Bugs in CPython 3.1.1 [wave.py]

2010-01-13 Thread Alf P. Steinbach
* Steven D'Aprano: Nobody is trying to understate the complexity of writing a large application that supports both 2.6 and 3.x, or of taking an existing library written for 2.5 and upgrading it to support 3.1. But the magnitude of these tasks is no greater (and potentially smaller) than supp

Re: Bugs in CPython 3.1.1 [wave.py]

2010-01-13 Thread Steven D'Aprano
On Wed, 13 Jan 2010 06:55:27 +0100, Alf P. Steinbach wrote: > * Steven D'Aprano: >> On Tue, 12 Jan 2010 23:47:31 +0100, Alf P. Steinbach wrote: >> PS: Next time it would have helped to include a URL to the issue. http://bugs.python.org/issue7681 FYI there is alrea

  1   2   >