Re: [ANN]: circuits-1.0b1 released!

2008-12-30 Thread John Krukoff
On Wed, 2008-12-31 at 09:44 +1000, James Mills wrote: > Hi all, > > I'm pleased to announce the release of circuits-1.0b1 I'm curious, you've a number of comparisons to Twisted on your site FAQ section, but this sounds like a much closer project to Kamaelia (http://www.kamaelia.org/Home). Are the

Re: [ANN]: circuits-1.0b1 released!

2008-12-30 Thread James Mills
On Wed, Dec 31, 2008 at 10:00 AM, John Krukoff wrote: > I'm curious, you've a number of comparisons to Twisted on your site FAQ > section, but this sounds like a much closer project to Kamaelia > (http://www.kamaelia.org/Home). Are these actually similar or am I > missing something important that

Re: get method

2008-12-30 Thread John Machin
On Dec 31, 10:58 am, "James Mills" wrote: > On Wed, Dec 31, 2008 at 9:15 AM, MRAB wrote: > > (snip) > > > A while back I posted a Python implementation of 'bag' (also called a > > multiset). The code would then become something like: > > What complexity is this ? The "armchair philosopher" appro

Re: get method

2008-12-30 Thread James Mills
On Wed, Dec 31, 2008 at 10:22 AM, John Machin wrote: (snip) > The "crawl through the shrubbery looking for evidence" approach > stumbles on the actual code: Yes I found his implementation soon after :) Not bad actually... I wonder why bag() isn't shipped with the std lib - perhaps in teh set mod

Re: get method

2008-12-30 Thread Steven D'Aprano
On Wed, 31 Dec 2008 10:29:14 +1000, James Mills wrote: > On Wed, Dec 31, 2008 at 10:22 AM, John Machin > wrote: (snip) > >> The "crawl through the shrubbery looking for evidence" approach >> stumbles on the actual code: > > Yes I found his implementation soon after :) Not bad actually... I > wo

Re: multiprocessing vs thread performance

2008-12-30 Thread James Mills
On Wed, Dec 31, 2008 at 8:42 AM, James Mills wrote: (snip) > As I continue to develop circuits and improve it's > core design as well as building it's ever growing set > of Components, I try to keep it as general as > possible - my main aim though is distributed > processing and architectures. (Se

Re: get method

2008-12-30 Thread MRAB
James Mills wrote: On Wed, Dec 31, 2008 at 10:22 AM, John Machin wrote: (snip) The "crawl through the shrubbery looking for evidence" approach stumbles on the actual code: Yes I found his implementation soon after :) Not bad actually... I wonder why bag() isn't shipped with the std lib - per

Re: get method

2008-12-30 Thread James Mills
On Wed, Dec 31, 2008 at 10:49 AM, Steven D'Aprano wrote: > What set module? Sorry I must have meant the collections module :) > Adding a multi-set or bag class to the collections module would be a good > idea though. Perhaps you should put in a feature request? :) Perhaps I will. cheers James

Re: get method

2008-12-30 Thread James Mills
On Wed, Dec 31, 2008 at 10:54 AM, MRAB wrote: > Occasionally someone posts here wanting to count items and solutions > involving dict or defaultdict are suggested, and I think that a 'bag' class > would be useful. The 'set' class was introduced first in a module, but it > soon became a builtin. My

Re: Triple quoted string in exec function ?

2008-12-30 Thread Steven D'Aprano
On Tue, 30 Dec 2008 21:16:39 +0100, Stef Mientki wrote: > I guess I've to remove all triple quoted strings from my code. There's no problem with triple-quoted strings. You just have to quote them properly. >>> text = """x = 1 ... y = x+2 ... del x ... print y ... """ >>> exec text 3 You can

Re: string in files

2008-12-30 Thread Steven D'Aprano
On Tue, 30 Dec 2008 11:53:17 +0100, Glauco wrote: >> thanks brother >> i mean how do i particularly assign (u = this) >> (y = is) >> in the strings up there. i have been able to split strings with any >> character sign. >> >> > > If i'm not wrong this is

Re: Triple quoted string in exec function ?

2008-12-30 Thread Steven D'Aprano
On Tue, 30 Dec 2008 15:35:28 -0600, Rob Williscroft wrote: > Stef Mientki wrote in news:mailman.6399.1230668197.3487.python- > l...@python.org in comp.lang.python: > And, by the way, exec is a *statement*, not a function! >> exec ( Init_Code, PG.P_Globals ) >> >> I've really

Re: Triple quoted string in exec function ?

2008-12-30 Thread John Machin
On Dec 31, 8:34 am, Steve Holden wrote: > Stef Mientki wrote: > > ibpe...@gmail.com wrote: > >> On Dec 30, 2:48 pm, Steve Holden wrote: > > >>> Stef Mientki wrote: > > hello, >       I'm running scripts, with the execute function (Python 2.5), > and it seems that triple quoted stri

TypeError: list indices must be integers

2008-12-30 Thread dubux
here is a function i wrote that doesnt work. i wrote to parse a "news" file that is going to work in conjunction with a website via mod_wsgi. my head hurts from looking at it so long. please help! i will further explain in the post. def news(x,y): # usage news(date, number) # x = d

Re: TypeError: list indices must be integers

2008-12-30 Thread Mensanator
On Dec 30, 7:46�pm, dubux wrote: > here is a function i wrote that doesnt work. i wrote to parse a "news" > file that is going to work in conjunction with a website via mod_wsgi. > my head hurts from looking at it so long. please help! i will further > explain in the post. > > def news(x,y): > � �

Re: TypeError: list indices must be integers

2008-12-30 Thread Steven D'Aprano
On Tue, 30 Dec 2008 17:46:11 -0800, dubux wrote: > i keep getting "TypeError: list indices must be integers" on the > following line "date = mylist[y]" > can someone please explain this and give me the proper way to achieve > what im trying to do? The obvious question is, what is the value of y?

Re: TypeError: list indices must be integers

2008-12-30 Thread John Machin
On Dec 31, 12:46 pm, dubux wrote: > my head hurts from looking at it so long. >                 mylist = map(lambda i: news_list[i], filter(lambda i: i%2 == > 0, range(len(news_list >                 date = mylist[y] My head hurts from looking at that only briefly. Any good reason why you

Re: Triple quoted string in exec function ?

2008-12-30 Thread Rob Williscroft
Steven D'Aprano wrote in news:016abfa1$0$6988$c3e8...@news.astraweb.com in comp.lang.python: > On Tue, 30 Dec 2008 15:35:28 -0600, Rob Williscroft wrote: > >> Stef Mientki wrote in news:mailman.6399.1230668197.3487.python- >> l...@python.org in comp.lang.python: >> > And, by the way, exec i

Re: parsing csv files class

2008-12-30 Thread alex goretoy
This line doesn't work for me. bufferp is empty afterwards. self.bufferp= [dict(zip(header,line)) for line in reader] needs to be this self.bufferp= [dict(zip(header,line)) for line in self.buffer] after reading from the reader, it becomes empty. Figured maybe someone would find this info useful

pycurl urllib fallback

2008-12-30 Thread alex goretoy
Hello All, I have this class I like to call pcrunchly. That works to do all my request via libcurl library. What I want to do is add capability for this class to fallback to urllib if pycurl module is not install or is not importable for some reason. I'm posting my whole class. Use it however you

greenlets and how they can be used

2008-12-30 Thread James Mills
Hey all, The "greenlet" from http://codespeak.net/py/dist/greenlet.html is a rather interesting way of handling flow of control. I can't seem to find anything else on the subject except for the above link and the most recent version 0.2 and it's tests. What can "greenlet"'s be used for ? What us

Memory leak problem (while using tkinter)

2008-12-30 Thread André
I have written a small program (my first Tkinter-based app) to play around the idea mentioned on http://rogeralsing.com/2008/12/07/genetic-programming-evolution-of-mona-lisa/ and, in doing so, have encountered a memory leak problem. I have seen mentions on the web of using the delete() method of

Re: TypeError: list indices must be integers

2008-12-30 Thread dubux
thanks for help everyone. it turned out the function itself worked fine.. it was the way i was calling it that was messing everything up. i ended up re-doing the whole thing as follows, and it now works perfectly. def news(x,y): news_file = '/home/scam/Desktop/www/info/news' news =

How to get back a list object from its string representation?

2008-12-30 Thread Harish Vishwanath
Hello, Consider : >>> li = [1,2,3] >>> repr(li) '[1, 2, 3]' Is there a standard way to get back li, from repr(li) ? Regards, Harish -- http://mail.python.org/mailman/listinfo/python-list

Re: parsing csv files class

2008-12-30 Thread Tim Roberts
"alex goretoy" wrote: > >This line doesn't work for me. bufferp is empty afterwards. > >self.bufferp= [dict(zip(header,line)) for line in reader] > >needs to be this >self.bufferp= [dict(zip(header,line)) for line in self.buffer] Yes, when I was writing this, I started out eliminating self.buffer

Re: AttributeError: 'module' object has no attribute 'DatagramHandler' (ubuntu-8.10, python 2.5.2)

2008-12-30 Thread Vinay Sajip
On Dec 29, 12:18 pm, "Chris Rebert" wrote: > There's your answer. I do agree though that the "class > logging.DatagramHandler" line in the docs is misleading to say the > least. Perhaps a docs bug should be filed... I've raised it on the sphinx-dev Google group. The documentation source markup f

Re: How to debug embeding Python?

2008-12-30 Thread Vinay Sajip
On Dec 30, 1:32 pm, "Diez B. Roggisch" wrote: > Additionally, printing might not work reliably in cases where the > stdout/err-streams aren't visible or otherwise in use. But thelogging-module > can log to files (or even system event logs *me thinks*) > Yes - syslog is supported on Unix, as well

Re: How to get back a list object from its string representation?

2008-12-30 Thread James Mills
On Wed, Dec 31, 2008 at 2:46 PM, Harish Vishwanath wrote: > Hello, > Consider : li = [1,2,3] repr(li) > '[1, 2, 3]' > Is there a standard way to get back li, from repr(li) ? Normally you would use eval(..) however this is considered by many to be evil and bad practise (especially by me!

Re: Parsing Excel spreadsheets

2008-12-30 Thread brooklineTom
andyh...@gmail.com wrote: > Hi, > > Can anybody recommend an approach for loading and parsing Excel > spreadsheets in Python. Any well known/recommended libraries for this? > > The only thing I found in a brief search was > http://www.lexicon.net/sjmachin/xlrd.htm, > but I'd rather get some more i

Re: How to get back a list object from its string representation?

2008-12-30 Thread Gabriel Genellina
En Wed, 31 Dec 2008 02:46:33 -0200, Harish Vishwanath escribió: li = [1,2,3] repr(li) '[1, 2, 3]' Is there a standard way to get back li, from repr(li) ? py> eval('[1, 2, 3]') [1, 2, 3] eval is like Pandora´s box, all kind of bad things can come from it. Do not use it with any user-sup

MemoryError when list append... plz help

2008-12-30 Thread [BON]
== s=[] for i in range(11000-1): for j in range(i+1, 11000): s.append(((i,j),sim)) == above sim is floating type. s.append is totally coducted 60,494,500 times. but this code raise MemoryError. My computer has 4G RAM. i think it'

Re: MemoryError when list append... plz help

2008-12-30 Thread James Mills
(Sorry for top posting): You are mad! Why on God's earth would you want to create a list containing 60 MILLION elements ? What is the use case ? What are you solving ? You may have 4G of ram, but I very seriously doubt you have 4G of ram available to Python. I have no idea how many bytes of mem

Re: MemoryError when list append... plz help

2008-12-30 Thread James Mills
On Wed, Dec 31, 2008 at 4:17 PM, James Mills wrote: > I have no idea how many bytes of memory > storing each element of a list consumes > let alone each float object, but I assure you > it's not going to be anywhere near that of > 60494500 4-bytes spaces (do floats in C > normally consume 4 bytes)

Re: How to get back a list object from its string representation?

2008-12-30 Thread Steven D'Aprano
On Wed, 31 Dec 2008 03:08:29 -0200, Gabriel Genellina wrote: > eval is like Pandora´s box, all kind of bad things can come from it. Do > not use it with any user-supplied string. If you can restrict the values > to be just constants, there is a "safe eval" recipe in > http://code.activestate.com

Re: Easy-to-use Python GUI

2008-12-30 Thread Tim Roberts
"Joel Koltner" wrote: >... >One approach that I like comes from SAX BASIC/WinWrap, which is more or less a >clone of Microsoft's Visual BASIC for Applications, but they (apparently) >wanted everything to still be human-readable, so they have a simple GUI >("form") builder that generates code th

Re: What is site-packages?

2008-12-30 Thread Tim Roberts
Hussein B wrote: >On Dec 28, 2:04 pm, "Chris Rebert" wrote: >> On Sun, Dec 28, 2008 at 3:40 AM, Hussein B wrote: >> > Hey, >> > What is /usr/lib/pythonx.y/site-packages folder and for what it is >> > used usually? >> >> I believe it's where third-party libraries are typically installed to. >> >>

Re: Cheetah

2008-12-30 Thread Tim Roberts
sopherf...@gmail.com wrote: > >1. In Cheetah 2.0.1, both from python 2.5.2 and 2.6, after I do a >#from datetime import date, most of the datetime objects seem to work >fine. For example, $date(2008, 12, 15) works. However $date.today() >does not work and I get an exception required argument year n

Re: why cannot assign to function call

2008-12-30 Thread Tim Roberts
Aaron Brady wrote: > >I think the problem goes deeper than just English. In any language >that has a plural, the propositions in question come out as, 'one >thing is two things' or 'two things are one thing'. According to some >rules, these are ungrammatical sentences, due to plurality >disagree

Re: multiprocessing vs thread performance

2008-12-30 Thread Tim Roberts
Christian Heimes wrote: > >You have missed an important point. A well designed application does >neither create so many threads nor processes. The creation of a thread >or forking of a process is an expensive operation. That actually depends on the operating system. As one example, thread creati

<    1   2