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

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: 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: 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: 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: 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: 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: 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

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: 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

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 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: 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: 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: 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

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: 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 =

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

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

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

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

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: 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: 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 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): > � �

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: 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

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: 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 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: 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: 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 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: 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 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: 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 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: [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: [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: Python 3.0 Curses Unicode

2008-12-30 Thread Damian Johnson
Just resolved the issue (turned out to be an issue with linked ncurses libraries). If others run into this discussion of the solution can be found at: http://bugs.python.org/issue4787 Cheers! -Damian On Mon, Dec 29, 2008 at 10:30 PM, Damian Johnson wrote: > It seems as if the curses module in P

Re: Triple quoted string in exec function ?

2008-12-30 Thread Gabriel Genellina
En Tue, 30 Dec 2008 18:16:39 -0200, Stef Mientki escribió: ibpe...@gmail.com wrote: the message Steven sent you is ok to explain how to work with triple quote Yes, but not to work around my problem. I guess I've to remove all triple quoted strings from my code. Why so? You only have to a

Re: get method

2008-12-30 Thread James Mills
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 ? cheers James -- http://mail.python.org/mailman/listinfo/python-list

[ANN]: circuits-1.0b1 released!

2008-12-30 Thread James Mills
Hi all, I'm pleased to announce the release of circuits-1.0b1 Overview == circuits is an event-driven framework with a focus on Component Software Architectures where System Functionality is defined in Components. Components communicate with one another by propagating events throughout the s

Re: Understanding search queries, semantics, and "Meaning" ...aren't we all looking for meaning?

2008-12-30 Thread 5lvqbwl02
> > library, as I'm looking to learn to fish, so to speak, and to learn a > > bit about the biology of fish. > > I'm going to break rule #1 of your requirements but in an unexpected > way. Rather than studying PostgreSQL, MySQL, or Oracle, why don't you > crack open the topic of relational database

Re: get method

2008-12-30 Thread MRAB
James Mills wrote: On Tue, Dec 30, 2008 at 7:10 PM, Roel Schroeven wrote: Hm, you just changed an O(n) algorithm to an O(n**2) algorithm. No big deal for short strings, but try your solution on a string with length 1 and see the difference. On my computer the O(n) version takes 0.008 second

Re: need help with list/variables

2008-12-30 Thread John Machin
On Dec 31, 6:41 am, 5lvqbw...@sneakemail.com wrote: > On Dec 30, 11:31 am, wx1...@gmail.com wrote: > > > I have a list and would like to parse the list appending each list > > item to the end of a variable on a new line. > > > for instance > > > mylist = ['something\n', 'another something\n', 'some

Re: python import sys.path

2008-12-30 Thread John Machin
On Dec 31, 5:05 am, "Kelly, Brian" wrote: > I have both 2.4 and 2.5 interpreters installed on a linux box. The > PythonPath is set to : > > PYTHONPATH=/usr/lib64/portage/pym:/prod/bacula/local/lib64/python2.4/site-pa > ckages:/prod/bacula/local/lib/python2.4/site-packages > > My main script is get

Re: multiprocessing vs thread performance

2008-12-30 Thread James Mills
On Wed, Dec 31, 2008 at 12:29 AM, Aaron Brady wrote: > James, Hi. I'm glad you asked; I never know how "out there" my > comments are (but surmise that feedback is always a good thing). What > I was thinking was, I didn't know Virtual Synchrony, and I've never > used Erlang, but I'm interested in

Re: Python in C

2008-12-30 Thread Stefan Behnel
akineko wrote: > The more you work on Python, the harder you can go back to C or C++ > world. > > I use SWIG, instead. I think SWIG is a good way to mix two worlds. If you find it hard to go from Python back to C, you should have a look at Cython. http://cython.org/ Stefan -- http://mail.python

Re: get method

2008-12-30 Thread James Mills
On Tue, Dec 30, 2008 at 7:10 PM, Roel Schroeven wrote: > Hm, you just changed an O(n) algorithm to an O(n**2) algorithm. No big > deal for short strings, but try your solution on a string with length > 1 and see the difference. On my computer the O(n) version takes > 0.008 seconds, while your

Re: Read-Write Lock vs primitive Lock()

2008-12-30 Thread Gabriel Genellina
En Tue, 30 Dec 2008 06:16:23 -0200, k3xji escribió: As GLOBAL_LOOP_COUNT is 1000, now this is making a bottleneck on the readers. I had assumed that as everythread is given only 100 bytecodes to execute, that it will be enough to have a 1 value for this number to let other rthread start

Re: "return" in def

2008-12-30 Thread Bruno Desthuilliers
Steven D'Aprano a écrit : (snip) Avoiding early exits is an over-reaction to the Bad Old Days of spaghetti code. Mostly, yes. It can also be a way to help avoiding "resource leaks" (memory or whatever) - just like try/finally blocks or the 'with' statement in Python. But used wisely, earl

Re: embedding python in wxpython

2008-12-30 Thread Mike Driscoll
On Dec 30, 3:41 pm, Steve Holden wrote: > 5lvqbw...@sneakemail.com wrote: > > Hi, I've looked around for a way to allow a python console from within > > a wxPython application, but have only found stuff on embedded/ > > extending python with C/C++ or wxWidgets in C++, but not wxPython. > > > Is th

Re: need help with list/variables

2008-12-30 Thread Jonathan Gardner
On Dec 30, 11:41 am, 5lvqbw...@sneakemail.com wrote: > > >>> conc = lambda x,y: x[:] + y # concatenate 2 lists without side effects > >>> mylist = ['something\n', 'another something\n', 'something again\n'] > >>> myvar = reduce(conc, mylist) > >>> print myvar > "conc"? "side effects"? Missing Lisp

[ANN] PyYAML-3.08: Now with Python 3 support

2008-12-30 Thread Kirill Simonov
Announcing PyYAML-3.08 A new release of PyYAML is now available: http://pyyaml.org/wiki/PyYAML This release features complete support for Python 3. For compatibility notes between Python 2 and Python 3 versions, please see http://pyya

Re: embedding python in wxpython

2008-12-30 Thread Joe Strout
Steve Holden wrote: I'd like the console to be a bidirectional representation of what's going on in the gui, plus a general purpose evaluation environment where you can manipulate application data via some api which is automatically exposed to the console when the application opens up. I'm look

Re: Parsing Excel spreadsheets

2008-12-30 Thread John Machin
On Dec 31, 5:48 am, Mike Driscoll wrote: > On Dec 30, 10:07 am, "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

Re: SQL, lite lite lite

2008-12-30 Thread Bruno Desthuilliers
Aaron Brady a écrit : On Dec 30, 11:16 am, prueba...@latinmail.com wrote: (snip) You really do like to reinvent the wheels do you? :-) Nothing wrong with that. Just be aware that most people that really need what you are proposing are probably already using mature feature rich libraries for tha

Re: Understanding search queries, semantics, and "Meaning" ...aren't we all looking for meaning?

2008-12-30 Thread Jonathan Gardner
On Dec 30, 12:35 pm, 5lvqbw...@sneakemail.com wrote: > I have Section 4.4.1 of SICP rattling around in my head (database > queries), and I'm trying to come up with a simple dictionary-based > database in Python to represent circuit diagrams.  My main confusion > isn't one of implementation, but a m

Re: SQL, lite lite lite

2008-12-30 Thread Bruno Desthuilliers
Gerhard Häring a écrit : Bruno Desthuilliers wrote: Aaron Brady a écrit : Hi all, (snip) > I don't think relational data can be read and written very easily in Python. Did you try SQLAlchemy or Django's ORM ? [...] Using an ORM when you don't grasp the relational model and/or the SQL

Re: win32gui

2008-12-30 Thread Mike Driscoll
On Dec 30, 3:22 pm, Gandalf wrote: > I'm searching the win32gui hooks for a function to get the windowClass > position any idea? > > thanks! Try looking in the docs: http://docs.activestate.com/activepython/2.4/pywin32/win32gui.html I think the GetWindowPlacement() might be what you're looking

Re: embedding python in wxpython

2008-12-30 Thread Steve Holden
5lvqbw...@sneakemail.com wrote: > Hi, I've looked around for a way to allow a python console from within > a wxPython application, but have only found stuff on embedded/ > extending python with C/C++ or wxWidgets in C++, but not wxPython. > > Is this easy to do? Can someone point me in the right

Re: Triple quoted string in exec function ?

2008-12-30 Thread Rob Williscroft
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 doubt that this is a statement, > unless I don't understand what a sta

Re: Triple quoted string in exec function ?

2008-12-30 Thread Steve Holden
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 strings are not allowed. Is there a wor

Re: embedding python in wxpython

2008-12-30 Thread Jervis Whitley
On Wed, Dec 31, 2008 at 7:21 AM, Stef Mientki wrote: > 5lvqbw...@sneakemail.com wrote: > >> Hi, I've looked around for a way to allow a python console from within >> a wxPython application, but have only found stuff on embedded/ >> extending python with C/C++ or wxWidgets in C++, but not wxPython.

Re: SQL, lite lite lite

2008-12-30 Thread Gerhard Häring
Bruno Desthuilliers wrote: Aaron Brady a écrit : Hi all, (snip) > I don't think relational data can be read and written very easily in Python. Did you try SQLAlchemy or Django's ORM ? [...] Using an ORM when you don't grasp the relational model and/or the SQL query language is futile.

Re: select.select and socket.setblocking

2008-12-30 Thread Jean-Paul Calderone
On Tue, 30 Dec 2008 15:55:51 -0500, Jean-Paul Calderone wrote: On Tue, 30 Dec 2008 14:41:17 -0600, Grant Edwards wrote: On 2008-12-30, Francesco Bochicchio wrote: 3. AFAIK (sorry, I feel acronym-ly today ;), there is no difference in select between blocking and non-blocking mode. The differ

Re: select.select and socket.setblocking

2008-12-30 Thread Jean-Paul Calderone
On Tue, 30 Dec 2008 14:41:17 -0600, Grant Edwards wrote: On 2008-12-30, Francesco Bochicchio wrote: 3. AFAIK (sorry, I feel acronym-ly today ;), there is no difference in select between blocking and non-blocking mode. The difference is in the recv (again, assuming that you use TCP as protocol

Re: select.select and socket.setblocking

2008-12-30 Thread Grant Edwards
On 2008-12-30, Francesco Bochicchio wrote: > 3. AFAIK (sorry, I feel acronym-ly today ;), there is no difference in > select between blocking and non-blocking mode. The difference is in the > recv (again, assuming that you use TCP as protocol, that is AF_INET, > SOCK_STREAM), which in the block

Re: PIL - font kerning

2008-12-30 Thread carsn
On Dec 23, 9:51 pm, Ivan Illarionov wrote: > On Dec 23, 11:22 pm, Ivan Illarionov > wrote: > > > > > On 23 дек, 16:44, carsn wrote: > > > > Hey all, > > > > anybody know, if there´s a way to specify the kerning of a font, when > > > you draw text withPIL? > > > > I´d like to achieve the same eff

Understanding search queries, semantics, and "Meaning" ...aren't we all looking for meaning?

2008-12-30 Thread 5lvqbwl02
I have Section 4.4.1 of SICP rattling around in my head (database queries), and I'm trying to come up with a simple dictionary-based database in Python to represent circuit diagrams. My main confusion isn't one of implementation, but a matter of "big thinking", fundamentally, about the problem. Pl

Re: Triple quoted string in exec function ?

2008-12-30 Thread Jean-Paul Calderone
On Tue, 30 Dec 2008 21:16:39 +0100, 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 strings are not allowed. Is there a w

Re: embedding python in wxpython

2008-12-30 Thread Stef Mientki
5lvqbw...@sneakemail.com wrote: Hi, I've looked around for a way to allow a python console from within a wxPython application, but have only found stuff on embedded/ extending python with C/C++ or wxWidgets in C++, but not wxPython. Is this easy to do? Can someone point me in the right directio

Re: Triple quoted string in exec function ?

2008-12-30 Thread Stef Mientki
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 strings are not allowed. Is there a workaround, or is this a fundamental problem of t

Re: embedding python in wxpython

2008-12-30 Thread Mike Driscoll
On Dec 30, 1:52 pm, 5lvqbw...@sneakemail.com wrote: > Hi, I've looked around for a way to allow a python console from within > a wxPython application, but have only found stuff on embedded/ > extending python with C/C++ or wxWidgets in C++, but not wxPython. > > Is this easy to do?  Can someone poi

Re: need help with list/variables

2008-12-30 Thread Albert Hopkins
On Tue, 2008-12-30 at 11:31 -0800, wx1...@gmail.com wrote: > I have a list and would like to parse the list appending each list > item to the end of a variable on a new line. > > for instance > > mylist = ['something\n', 'another something\n', 'something again\n'] > > then parse mylist to make i

Re: duck typing at will

2008-12-30 Thread Bruno Desthuilliers
Jose Mora a écrit : Duck typing is called that way because "If it looks like a duck and quacks like a duck, it must be a duck." or at least something close enough... I think it would be good to have also "If the programmer wants to deal with it like a duck, it must be a duck" DWIM[1] just d

embedding python in wxpython

2008-12-30 Thread 5lvqbwl02
Hi, I've looked around for a way to allow a python console from within a wxPython application, but have only found stuff on embedded/ extending python with C/C++ or wxWidgets in C++, but not wxPython. Is this easy to do? Can someone point me in the right direction? Also, typically when you embed

Re: need help with list/variables

2008-12-30 Thread Tim Chase
I have a list and would like to parse the list appending each list item to the end of a variable on a new line. for instance mylist = ['something\n', 'another something\n', 'something again\n'] then parse mylist to make it appear in my variable in this format: myvar = """ something another som

Re: need help with list/variables

2008-12-30 Thread 5lvqbwl02
On Dec 30, 11:31 am, wx1...@gmail.com wrote: > I have a list and would like to parse the list appending each list > item to the end of a variable on a new line. > > for instance > > mylist = ['something\n', 'another something\n', 'something again\n'] > > then parse mylist to make it appear in my va

Re: thread, multiprocessing: communication overhead

2008-12-30 Thread Duncan Booth
mk wrote: >> CMIIW, but I believe your timing function includes the time to launch >> the actual processes and threads, create the synch. objects, etc. You >> might try it again, creating them first, starting the timer, then >> loading them. > > Except I don't know how to do that using timeit.T

need help with list/variables

2008-12-30 Thread wx1234
I have a list and would like to parse the list appending each list item to the end of a variable on a new line. for instance mylist = ['something\n', 'another something\n', 'something again\n'] then parse mylist to make it appear in my variable in this format: myvar = """ something another some

Re: select.select and socket.setblocking

2008-12-30 Thread Jean-Paul Calderone
On Tue, 30 Dec 2008 19:19:08 +0100, Francesco Bochicchio wrote: [snip] If you are interested in socket errors, you should also fill the third 'fd-set' in the select call, and after select returns check that fd is not in it anymore: ready = select.select( [fd],[], [fd] ) if fd in ready[2]:

Re: SQL, lite lite lite

2008-12-30 Thread Aaron Brady
On Dec 30, 11:16 am, prueba...@latinmail.com wrote: > On Dec 29, 1:06 pm, Aaron Brady wrote: snip > > My idea is to create a 'Relation' class.  The details are basically > > open, such as whether to back it with 'sqllite3', 'shelve', 'mmap', or > > just mapping and sequence objects; what the simpl

Re: duck typing at will

2008-12-30 Thread Ned Deily
In article <6e1bfdea0812301042x70ab57capf99ce73d364d5...@mail.gmail.com>, "Jose Mora" wrote: >[...] > I mean, some tasks are rather boring in python when compared with php, > for example, let's imagine we have a dictionary that contains > dictionaries that contain the times that a key appears. W

Re: duck typing at will

2008-12-30 Thread MRAB
Jose Mora wrote: Duck typing is called that way because "If it looks like a duck and quacks like a duck, it must be a duck." I think it would be good to have also "If the programmer wants to deal with it like a duck, it must be a duck" I mean, some tasks are rather boring in python when compared

Re: Parsing Excel spreadsheets

2008-12-30 Thread Mike Driscoll
On Dec 30, 10:07 am, "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 > washttp://www.lexicon.net/sjmachin/xlrd.htm, > but I'd

Re: folder extraction

2008-12-30 Thread Mike Driscoll
On Dec 30, 9:30 am, ibpe...@gmail.com wrote: > how do i get along with this task of extracting multiples folder and > generating their names individually in a their respective files as > they were generated. Are you talking about unzipping an archive or walking a directory? If the former, see the

Re: Parsing Excel spreadsheets

2008-12-30 Thread Steve Holden
Tino Wildenhain wrote: > r wrote: >> On Dec 30, 10:07 am, "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 >>> wash

Re: wxPython.button.disabled still catching clicks

2008-12-30 Thread Mike Driscoll
On Dec 30, 3:04 am, mynthon wrote: > On Dec 23, 6:12 pm, Mike Driscoll wrote: > > > > > On Dec 23, 7:27 am,mynthon wrote: > > > > On Dec 23, 11:58 am, Aaron Brady wrote: > > > > > On Dec 23, 4:50 am,mynthon wrote: > > > > > > Hello! (sorry for my english) > > > > > > I have a problem with button

duck typing at will

2008-12-30 Thread Jose Mora
Duck typing is called that way because "If it looks like a duck and quacks like a duck, it must be a duck." I think it would be good to have also "If the programmer wants to deal with it like a duck, it must be a duck" I mean, some tasks are rather boring in python when compared with php, for exam

Re: select.select and socket.setblocking

2008-12-30 Thread Francesco Bochicchio
Laszlo Nagy ha scritto: I'm using this method to read from a socket: def read_data(self,size): """Read data from connection until a given size.""" res = "" fd = self.socket.fileno() while not self.stop_requested.isSet(): remaining = size - len(res)

python import sys.path

2008-12-30 Thread Kelly, Brian
I have both 2.4 and 2.5 interpreters installed on a linux box. The PythonPath is set to : PYTHONPATH=/usr/lib64/portage/pym:/prod/bacula/local/lib64/python2.4/site-pa ckages:/prod/bacula/local/lib/python2.4/site-packages My main script is getting called like so: python2.4 cleanup.py wrkstnbs Th

Re: Parsing Excel spreadsheets

2008-12-30 Thread Tino Wildenhain
r wrote: On Dec 30, 10:07 am, "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 washttp://www.lexicon.net/sjmachin/xlrd.htm, but I'd r

Re: SQL, lite lite lite

2008-12-30 Thread pruebauno
On Dec 29, 1:06 pm, Aaron Brady wrote: > Hi all, > > About a year ago, I posted an idea I was having about thread > synchronization to the newsgroup.  However, I did not explain it well, > and I really erred on the side of brevity.  (After some finagling, Mr. > Bieber and I decided it wasn't exact

Re: Python in C

2008-12-30 Thread akineko
Hello Skip, Thank you for your response. Your posting reminds me that we, Python community as a whole, owe a great deal to Python developers. The problem is ... The more you work on Python, the harder you can go back to C or C++ world. I use SWIG, instead. I think SWIG is a good way to mix two w

Re: thread, multiprocessing: communication overhead

2008-12-30 Thread Duncan Booth
mk wrote: > This time I decided to test communication overhead in multithreaded / > multiprocess communication. The results are rather disappointing, that > is, communication overhead seems to be very high. In each of the > following functions, I send 10,000 numbers to the function / 10 thread

Re: thread, multiprocessing: communication overhead

2008-12-30 Thread mk
Aaron Brady wrote: snips def threadsemfun(): sem = threading.Semaphore() def threadlockfun(): sem = threading.Semaphore() You used a Semaphore for both lock objects here. Right... I corrected that (simply changed to threading.Lock() in threadlockfun) and the result is muc

Re: Parsing Excel spreadsheets

2008-12-30 Thread r
On Dec 30, 10:07 am, "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 > washttp://www.lexicon.net/sjmachin/xlrd.htm, > but I'd

Re: thread, multiprocessing: communication overhead

2008-12-30 Thread Aaron Brady
On Dec 30, 9:46 am, mk wrote: > Hello everyone, > > This time I decided to test communication overhead in multithreaded / > multiprocess communication. The results are rather disappointing, that > is, communication overhead seems to be very high. In each of the > following functions, I send 10,000

  1   2   >