Re: bisect intersection

2008-05-05 Thread Gabriel Genellina
En Mon, 28 Apr 2008 13:50:13 -0300, Robert Bossy <[EMAIL PROTECTED]> escribió: > I stumbled into a sorted list intersection algorithm by Baeza-Yates > which I found quite elegant. For the lucky enough to have a springerlink > access, here's the citation: > http://dblp.uni-trier.de/rec/bibtex/conf/

Re: Feature suggestion: sum() ought to use a compensated summation algorithm

2008-05-05 Thread Szabolcs Horvát
Duncan Booth wrote: Szabolcs Horvát <[EMAIL PROTECTED]> wrote: I thought that it would be very nice if the built-in sum() function used this algorithm by default. Has this been brought up before? Would this have any disadvantages (apart from a slight performance impact, but Python is a high

Re: config files in python

2008-05-05 Thread Michael Ströder
sandipm wrote: In my application, I have some configurable information which is used by different processes. currently I have stored configration in a conf.py file as name=value pairs, and I am importing conf.py file to use this variable. it works well import conf print conf.SomeVariable but i

Re: Feature suggestion: sum() ought to use a compensated summation algorithm

2008-05-05 Thread Szabolcs Horvát
Gabriel Genellina wrote: Python doesn't require __add__ to be associative, so this should not be used as a general sum replacement. It does not _require_ this, but using an __add__ that is not commutative and associative, or has side effects, would qualify as a serious misuse, anyway. So I

Re: Feature suggestion: sum() ought to use a compensated summation algorithm

2008-05-05 Thread Raymond Hettinger
On May 3, 9:50 am, Szabolcs Horvát <[EMAIL PROTECTED]> wrote: > I did the following calculation:  Generated a list of a million random > numbers between 0 and 1, constructed a new list by subtracting the mean > value from each number, and then calculated the mean again. > > The result should be 0,

Re: Feature suggestion: sum() ought to use a compensated summation algorithm

2008-05-05 Thread Raymond Hettinger
> > > However I find the seccond argument hack ugly. Does the sum way have any > > > performance advantages over the reduce way? > > > Yes, sum() is faster: ... > Not really; you measure the import and the attribute access time in > the second case. sum() is 2x faster for adding numbers only: Try

Re: Feature suggestion: sum() ought to use a compensated summation algorithm

2008-05-05 Thread Szabolcs
On May 5, 9:37 am, Szabolcs Horvát <[EMAIL PROTECTED]> wrote: > Gabriel Genellina wrote: > > > Python doesn't require __add__ to be associative, so this should not be > > used as a general sum replacement. > > It does not _require_ this, but using an __add__ that is not commutative > and associati

Re: Feature suggestion: sum() ought to use a compensated summation algorithm

2008-05-05 Thread Duncan Booth
"Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Sun, 04 May 2008 12:58:25 -0300, Duncan Booth > <[EMAIL PROTECTED]> escribió: > >> Szabolcs Horvát <[EMAIL PROTECTED]> wrote: >> >>> I thought that it would be very nice if the built-in sum() function >>> used this algorithm by default. Has th

Re: Weird import problem

2008-05-05 Thread Anton81
>> NS/dir1/file1.py >> NS/dir2/file2.py > This *must* be wrong or at least not the full directory listing - please > read It is the directory structure in one of the python paths. > Missing __init__.py in the dir2? Oh right. I forgot about this. Thank you! -- http://mail.python.org/mailman/listinf

How to pass a multiline arg to exec('some.exe arg')?

2008-05-05 Thread n00m
os:windows ml = 'line1 \n line2 \n line3 \n' exec('some.exe "' + ml + '"') and some.exe get only 'line1'... -- http://mail.python.org/mailman/listinfo/python-list

Re: Feature suggestion: sum() ought to use a compensated summation algorithm

2008-05-05 Thread Duncan Booth
Szabolcs <[EMAIL PROTECTED]> wrote: > On May 5, 9:37 am, Szabolcs Horvát <[EMAIL PROTECTED]> wrote: >> Gabriel Genellina wrote: >> >> > Python doesn't require __add__ to be associative, so this should >> > not be > used as a general sum replacement. >> >> It does not _require_ this, but using an

Re: USB HID documentation?

2008-05-05 Thread Diez B. Roggisch
ETP wrote: > I have a little robot project I'm programming in python using the > Lynxmotion SSC-32 servo controller via serial. I'd like to use a USB > game controller (PS2 style) to control the robot. > > I've read a number of threads about the difficulty of using USB > without extensive unders

use php in python httpservers

2008-05-05 Thread artasis
Hi, that is my task: I need to create python webserver-like extension(dll) which will run php and python scripts as plugins. I have no problems with dll creating and run python scripts, but I cannot understand how to run php(CLI is not a solution). Is there a way to solve this problem? I've thought

Re: How to pass a multiline arg to exec('some.exe arg')?

2008-05-05 Thread n00m
Hint: for some reason in VBScript it works fine. What makes it different, with Python? I tried all possible ways to combine quotes, ' and ", with no avail -- http://mail.python.org/mailman/listinfo/python-list

Re: How to pass a multiline arg to exec('some.exe arg')?

2008-05-05 Thread alexelder
On May 5, 10:25 am, n00m <[EMAIL PROTECTED]> wrote: > os:windows > ml = 'line1 \n line2 \n line3 \n' > exec('some.exe "' + ml + '"') > > and some.exe get only 'line1'... I think your problem lies with your "\n", escape chars. Assuming these are not arguments and are indeed separating statements, I

Re: How to pass a multiline arg to exec('some.exe arg')?

2008-05-05 Thread Peter Otten
n00m wrote: > os:windows > ml = 'line1 \n line2 \n line3 \n' > exec('some.exe "' + ml + '"') > > and some.exe get only 'line1'... My crystall ball says you want subprocess.call(["some.exe", ml]) exec is a python statement that executes python code. Peter -- http://mail.python.org/mailman/list

pygame music, cant read mp3?

2008-05-05 Thread globalrev
http://www.pygame.org/docs/ref/mixer.html import pygame #pygame.mixer.init(frequency=22050, size=-16, channels=2, buffer=3072) //it complained abiout words= so i guess its only the nbrs should be there// pygame.mixer.init(22050, -16, 2, 3072) pygame.mixer.music.load("example1.mp3") pygame.mixer

threading: getting latest elements from list/dict

2008-05-05 Thread Vaibhav.bhawsar
Hello I have a thread updating a dictionary with new elements. How can I check for new elements as they are inserted into the dictionary by the thread? In general is it safe to read a dictionary or a list while it is being updated by a running thread? Does the dictionary or list have to be locked w

Re: How to pass a multiline arg to exec('some.exe arg')?

2008-05-05 Thread n00m
actually, it's this doesn't work (again, in VBS the "same" construction works properly): f = os.popen('osql -E -S(local) -dpubs -w800 -Q"' + query + '"', 'r') res=f.readlines() === here "query" is a multiline string like: select getdate() select 555*666 select getdate() -- http://mail

Re: pygame music, cant read mp3?

2008-05-05 Thread Diez B. Roggisch
globalrev wrote: > http://www.pygame.org/docs/ref/mixer.html > > import pygame > > #pygame.mixer.init(frequency=22050, size=-16, channels=2, > buffer=3072) //it complained abiout words= > so i guess its only the nbrs should be there// > > pygame.mixer.init(22050, -16, 2, 3072) > pygame.mixer.m

Re: use php in python httpservers

2008-05-05 Thread Jeff
ctypes? -- http://mail.python.org/mailman/listinfo/python-list

confused about self, why not a reserved word?

2008-05-05 Thread globalrev
class Foo(object): def Hello(self): print "hi" object is purple, ie some sort of reserved word. why is self in black(ie a normal word) when it has special powers. replacing it with sel for example will cause an error when calling Hello. -- http://mail.python.org/mailman/li

Re: pygame music, cant read mp3?

2008-05-05 Thread globalrev
On 5 Maj, 13:47, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > globalrev wrote: > >http://www.pygame.org/docs/ref/mixer.html > > > import pygame > > > #pygame.mixer.init(frequency=22050, size=-16, channels=2, > > buffer=3072) //it complained abiout words= > > so i guess its only the nbrs should

Re: pygame music, cant read mp3?

2008-05-05 Thread globalrev
On 5 Maj, 14:03, globalrev <[EMAIL PROTECTED]> wrote: > On 5 Maj, 13:47, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > > > > globalrev wrote: > > >http://www.pygame.org/docs/ref/mixer.html > > > > import pygame > > > > #pygame.mixer.init(frequency=22050, size=-16, channels=2, > > > buffer=3072)

Re: confused about self, why not a reserved word?

2008-05-05 Thread Wojciech Walczak
2008/5/5, globalrev <[EMAIL PROTECTED]>: > class Foo(object): > def Hello(self): > print "hi" > > object is purple, ie some sort of reserved word. > > why is self in black(ie a normal word) when it has special powers. > replacing it with sel for example will cause an erro

Re: pygame music, cant read mp3?

2008-05-05 Thread Wojciech Walczak
2008/5/5, globalrev <[EMAIL PROTECTED]>: > pygame.mixer.music.load('C:/Python25/myPrograms/pygameProgs/example1.mp3') Are you sure that: os.path.exists('C:/Python25/myPrograms/pygameProgs/example1.mp3') == True? Check it with python. -- Regards, Wojtek Walczak http://www.stud.umk.pl/~wojtekwa

Re: confused about self, why not a reserved word?

2008-05-05 Thread Jean-Paul Calderone
On Mon, 5 May 2008 04:57:25 -0700 (PDT), globalrev <[EMAIL PROTECTED]> wrote: class Foo(object): def Hello(self): print "hi" object is purple, ie some sort of reserved word. What your text editor of choice does with syntax coloring is its own business. It doesn't really

Re: Problems with psycopg2

2008-05-05 Thread c james
David Anderson wrote: The thing is this query works fine on the console through psql, but not in my code? can anyone explain me why? On Thu, May 1, 2008 at 9:31 PM, David Anderson <[EMAIL PROTECTED] > wrote: Hi all I have this function: def checkName(sel

Re: confused about self, why not a reserved word?

2008-05-05 Thread Diez B. Roggisch
globalrev wrote: > class Foo(object): > def Hello(self): > print "hi" > > object is purple, ie some sort of reserved word. It is not. > why is self in black(ie a normal word) when it has special powers. > replacing it with sel for example will cause an error when calling > Hello. That must be

Re: confused about self, why not a reserved word?

2008-05-05 Thread J. Cliff Dyer
On Mon, 2008-05-05 at 04:57 -0700, globalrev wrote: > class Foo(object): > def Hello(self): > print "hi" > > object is purple, ie some sort of reserved word. > > why is self in black(ie a normal word) when it has special powers. > replacing it with sel for example will cause a

Re: using sqlite3 - execute vs. executemany; committing ...

2008-05-05 Thread Vlastimil Brom
> > > Thanks for further comments David, You are right, the choice of an appropriate data structure isn't easy; I described the requirements in an earlier post: http://mail.python.org/pipermail/python-list/2007-December/469506.html Here is a slightly modified sample of the text source I currently

Re: using sqlite3 - execute vs. executemany; committing ...

2008-05-05 Thread David
Hi Vlasta. Don't have time to reply to your mail in detail now. Will do so later. Have you tried the eGenix text tagging library? It sounds to me that this is exactly what you need: http://www.egenix.com/products/python/mxBase/mxTextTools/ Disclaimer: I've never actually used this library ;-)

Re: Where are Tkinter event.type constants defined?

2008-05-05 Thread Mike Driscoll
On May 4, 7:22 pm, Noah <[EMAIL PROTECTED]> wrote: > I'm trying to match against Event.type for KeyPress and ButtonPress. > Currently I'm using integer constants (2 and 4). Are these constants > defined anywhere? The docs talk about KeyPress and ButtonPress, but I > don't see them in any of the Tki

Re: confused about self, why not a reserved word?

2008-05-05 Thread Marc Christiansen
globalrev <[EMAIL PROTECTED]> wrote: > class Foo(object): >def Hello(self): >print "hi" > > object is purple, ie some sort of reserved word. > > why is self in black(ie a normal word) when it has special powers. Because `self` is just a name. Using `self` is a convention,

Re: confused about self, why not a reserved word?

2008-05-05 Thread globalrev
sorry i noticed now a little error, i was playing around a lot and saw that on the sel-example i had then called foo.hello() instead of foo.Hello(). but it was an informing error now i egt it. was wondering about self anyway so thanks for clearing it up. but it still is a bit confusing that u c

How to convert unicode string to unsigned char *

2008-05-05 Thread Simon Posnjak
Hi! I have a C module for which I created a wrapper with swig. The function def is: C: int some_thing(unsigned char * the_str); eg: Python: some_module.some_thing (the_str) Now I would like to feed it with a UTF-8 formatted string: test = u'Make \u0633\u0644\u0627\u0645, not war.' If I try

Re: How to convert unicode string to unsigned char *

2008-05-05 Thread Jean-Paul Calderone
On Mon, 5 May 2008 15:41:08 +0200, Simon Posnjak <[EMAIL PROTECTED]> wrote: Hi! I have a C module for which I created a wrapper with swig. The function def is: C: int some_thing(unsigned char * the_str); eg: Python: some_module.some_thing (the_str) Now I would like to feed it with a UTF-8

Re: Feature suggestion: sum() ought to use a compensated summation algorithm

2008-05-05 Thread Szabolcs
On May 5, 12:24 pm, Duncan Booth <[EMAIL PROTECTED]> wrote: > Szabolcs <[EMAIL PROTECTED]> wrote: > > On May 5, 9:37 am, Szabolcs Horvát <[EMAIL PROTECTED]> wrote: > >> Gabriel Genellina wrote: > > >> > Python doesn't require __add__ to be associative, so this should > >> > not be > > used as a gen

Re: pygame music, cant read mp3?

2008-05-05 Thread globalrev
On 5 Maj, 14:17, "Wojciech Walczak" <[EMAIL PROTECTED]> wrote: > 2008/5/5, globalrev <[EMAIL PROTECTED]>: > > > pygame.mixer.music.load('C:/Python25/myPrograms/pygameProgs/example1.mp3') > > Are you sure that: > > os.path.exists('C:/Python25/myPrograms/pygameProgs/example1.mp3') == True? > > Check

Re: confused about self, why not a reserved word?

2008-05-05 Thread [EMAIL PROTECTED]
> the class-thing seems inside out somehow in python. if im doing > foo.Hello() im already saying that im using the class foo because i > did foo=Foo() before and then still when calling Hello() i am > invisibly passing the class itself a s a parameter by default? > just seems backwards and weird.

Re: pygame music, cant read mp3?

2008-05-05 Thread Dan Upton
On Mon, May 5, 2008 at 10:09 AM, globalrev <[EMAIL PROTECTED]> wrote: > On 5 Maj, 14:17, "Wojciech Walczak" <[EMAIL PROTECTED]> > wrote: > > 2008/5/5, globalrev <[EMAIL PROTECTED]>: > > > > > > > pygame.mixer.music.load('C:/Python25/myPrograms/pygameProgs/example1.mp3') > > > > > Are you sure

Re: How to convert unicode string to unsigned char *

2008-05-05 Thread Jean-Paul Calderone
On Mon, 5 May 2008 16:05:08 +0200, Simon Posnjak <[EMAIL PROTECTED]> wrote: On Mon, May 5, 2008 at 3:48 PM, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: On Mon, 5 May 2008 15:41:08 +0200, Simon Posnjak <[EMAIL PROTECTED]> wrote: > Hi! > > I have a C module for which I created a wrapper with s

Re: SSL through python. possible ?

2008-05-05 Thread TkNeo
On May 2, 1:43 pm, "Giampaolo Rodola'" <[EMAIL PROTECTED]> wrote: > On 29 Apr, 15:56,TkNeo<[EMAIL PROTECTED]> wrote: > > > I need to do SSL file transfer using python? Is there a library i can > > use ? > > > Thanks. > > If you have patience you can wait for Python 2.6 which will include a > new ss

get the pid of a process with pexpect

2008-05-05 Thread Karim Bernardet
Hi I am using pexpect to do ssh tunneling and to open a vnc server (jobs on a grid cluster). When the job is canceled, these 2 processes remain on the worker node (they are detached), so I have to kill them (using a trap command in the bash script of the job) but I need the pid of each proces

Nested os.path.join()'s

2008-05-05 Thread Paul Scott
Today, I needed to concatenate a bunch of directory paths and files together based on user input to create file paths. I achieved this through nested os.path.join()'s which I am unsure if this is a good thing or not. example: if os.path.exists(os.path.join(basedir,picdir)) == True : blah bla

Browser + local Python-based web server vs. wxPython

2008-05-05 Thread python
I'm looking at rewriting some legacy VB applications and am pondering which of the following techniques to use: 1. Browser based GUI with local web server (Browser + wsgiref.simple_server) (I'm assuming that simple_server is class I want to build from for a local web server) -OR- 2. wxPython bas

Re: Nested os.path.join()'s

2008-05-05 Thread Paul Scott
On Mon, 2008-05-05 at 16:21 +0200, Paul Scott wrote: > example: > > if os.path.exists(os.path.join(basedir,picdir)) == True : > blah blah > Sorry, pasted the wrong example... Better example: pics = glob.glob(os.path.join(os.path.join(basedir,picdir),'*')) > Question is, is there a bet

Re: pygame music, cant read mp3?

2008-05-05 Thread globalrev
On 5 Maj, 16:09, globalrev <[EMAIL PROTECTED]> wrote: > On 5 Maj, 14:17, "Wojciech Walczak" <[EMAIL PROTECTED]> > wrote: > > > 2008/5/5, globalrev <[EMAIL PROTECTED]>: > > > > pygame.mixer.music.load('C:/Python25/myPrograms/pygameProgs/example1.mp3') > > > Are you sure that: > > > os.path.exists('C

Re: How to convert unicode string to unsigned char *

2008-05-05 Thread Simon Posnjak
On Mon, May 5, 2008 at 4:16 PM, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: > > On Mon, 5 May 2008 16:05:08 +0200, Simon Posnjak <[EMAIL PROTECTED]> wrote: > > > On Mon, May 5, 2008 at 3:48 PM, Jean-Paul Calderone <[EMAIL PROTECTED]> > wrote: > > > > > On Mon, 5 May 2008 15:41:08 +0200, Simon Po

Re: Nested os.path.join()'s

2008-05-05 Thread Jean-Paul Calderone
On Mon, 05 May 2008 16:28:33 +0200, Paul Scott <[EMAIL PROTECTED]> wrote: On Mon, 2008-05-05 at 16:21 +0200, Paul Scott wrote: example: if os.path.exists(os.path.join(basedir,picdir)) == True : blah blah Sorry, pasted the wrong example... Better example: pics = glob.glob(os.path.join

Re: pygame music, cant read mp3?

2008-05-05 Thread globalrev
On 5 Maj, 16:29, globalrev <[EMAIL PROTECTED]> wrote: > On 5 Maj, 16:09, globalrev <[EMAIL PROTECTED]> wrote: > > > > > On 5 Maj, 14:17, "Wojciech Walczak" <[EMAIL PROTECTED]> > > wrote: > > > > 2008/5/5, globalrev <[EMAIL PROTECTED]>: > > > > > pygame.mixer.music.load('C:/Python25/myPrograms/pygam

Re: Nested os.path.join()'s

2008-05-05 Thread Paul Scott
On Mon, 2008-05-05 at 10:34 -0400, Jean-Paul Calderone wrote: > How about not nesting the calls? > > >>> from os.path import join > >>> join(join('x', 'y'), 'z') == join('x', 'y', 'z') > True > >>> > Great! Thanks. Didn't realise that you could do that... :) --Paul All Email o

Re: Nested os.path.join()'s

2008-05-05 Thread Grant Edwards
On 2008-05-05, Paul Scott <[EMAIL PROTECTED]> wrote: > Today, I needed to concatenate a bunch of directory paths and files > together based on user input to create file paths. I achieved this > through nested os.path.join()'s which I am unsure if this is a good > thing or not. > > example: > > if

Re: confused about self, why not a reserved word?

2008-05-05 Thread Bruno Desthuilliers
globalrev a écrit : sorry i noticed now a little error, i was playing around a lot and saw that on the sel-example i had then called foo.hello() instead of foo.Hello(). but it was an informing error now i egt it. was wondering about self anyway so thanks for clearing it up. but it still is a

Pygame and PGU

2008-05-05 Thread Zaka
Hi. I need some help to make map system in PGU. For exmple we have 2 maps and when we leave first we enter to second. ! ___ -- http://mail.python.org/mailman/listinfo/python-list

Re: Pygame and PGU

2008-05-05 Thread Diez B. Roggisch
Zaka wrote: > Hi. I need some help to make map system in PGU. For exmple we have 2 > maps and when we leave first we enter to second. > > > >! > > > ___ What is a PGU? What is a map-system? And what is that ascii art above? And what might you

Re: Pygame and PGU

2008-05-05 Thread Zaka
On 5 Maj, 16:45, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Zaka wrote: > > Hi. I need some help to make map system in PGU. For exmple we have 2 > > maps and when we leave first we enter to second. > > > > >! > > > ___ > > What is a PGU? What is

Re: How to pass a multiline arg to exec('some.exe arg')?

2008-05-05 Thread n00m
it can be done like this: osql=popen2.popen2('osql -E -S(local) -dpubs -c"GO" -n - w800') osql[1].write(query+'\nGO\n') osql[1].close() res=osql[0].readlines() osql[0].close() res=join(res,'') btw, is it necessarily to close(

Interested to code leecher mods in python?

2008-05-05 Thread WorldWide
Hi. Is here anyone interested to help us code some bittorrent leecher mods? We need a bit help with the gui in the mods. You just need to have python knowledge. We have our own [quite successful] forums and a great team. Please email me: [EMAIL PROTECTED] best regards -- http://mail.python.org/ma

Re: pygame music, cant read mp3?

2008-05-05 Thread J. Cliff Dyer
On Mon, 2008-05-05 at 07:32 -0700, globalrev wrote: > On 5 Maj, 16:29, globalrev <[EMAIL PROTECTED]> wrote: > > On 5 Maj, 16:09, globalrev <[EMAIL PROTECTED]> wrote: > > > > > > > > > On 5 Maj, 14:17, "Wojciech Walczak" <[EMAIL PROTECTED]> > > > wrote: > > > > > > 2008/5/5, globalrev <[EMAIL PROTEC

Re: pygame music, cant read mp3?

2008-05-05 Thread Diez B. Roggisch
> directory = ['C:','Python25','myPrograms','pygameProgs','dront.mp3'] > os.path.join(directory) > > Then python can worry about the gritty details, and you don't have to. Or somewhat neater IMHO: os.path.join('C:','Python25','myPrograms','pygameProgs','dront.mp3') Diez -- http://mail.python.

Re: logger output

2008-05-05 Thread skunkwerk
On May 4, 10:40 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Mon, 05 May 2008 00:33:12 -0300,skunkwerk<[EMAIL PROTECTED]> escribió: > > > > > i'm redirecting the stdout & stderr of my python program to a log. > > Tests i've done on a simple program with print statements, etc. work > > fi

Re: Python application distribution

2008-05-05 Thread Ville M. Vainio
ron.longo wrote: unable to execute. Why is this? At this point I'm not really keen on handing out the source files to my application, it feels unprofessional. If you plan to deploy on windows, py2exe could be the more "professional" approach you are thinking of. -- http://mail.python.org/m

Re: Python application distribution

2008-05-05 Thread Ville M. Vainio
ron.longo wrote: > unable to execute. Why is this? At this point I'm not really keen on > handing out the source files to my application, it feels unprofessional. If you plan to deploy on windows, py2exe could be the more "professional" approach you are thinking of. -- http://mail.python.org

Re: Feature suggestion: sum() ought to use a compensated summation algorithm

2008-05-05 Thread Rhamphoryncus
On May 3, 4:31 pm, Thomas Dybdahl Ahle <[EMAIL PROTECTED]> wrote: > On Sat, 2008-05-03 at 21:37 +, Ivan Illarionov wrote: > > On Sat, 03 May 2008 20:44:19 +0200, Szabolcs Horvát wrote: > > > > Arnaud Delobelle wrote: > > > >> sum() works for any sequence of objects with an __add__ method, not >

Re: How to convert unicode string to unsigned char *

2008-05-05 Thread Martin v. Löwis
> some_module.some_thing(the_string) function is a swig generated > function from a C lib. The C lib function expects unsigned char *. > > The generated function is: If you don't want to change the generated function, I recommend to put a wrapper around it, as Jean-Paul suggested: def some_thing

Re: generator functions in another language

2008-05-05 Thread castironpi
On May 5, 12:28 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Mon, 05 May 2008 00:09:02 -0300, hdante <[EMAIL PROTECTED]> escribió: > > > > > > >  Isn't this guy a bot ? :-) It's learning fast. I believe there is a > > "frame" in C, composed of its stack and globals. For generators in C,

Re: config files in python

2008-05-05 Thread Francesco Bochicchio
On Mon, 05 May 2008 00:35:51 -0700, sandipm wrote: > Hi, > In my application, I have some configurable information which is used > by different processes. currently I have stored configration in a > conf.py file as name=value pairs, and I am importing conf.py file to > use this variable. it works

Re: Feature suggestion: sum() ought to use a compensated summation algorithm

2008-05-05 Thread Robert Kern
Gabriel Genellina wrote: Python doesn't require __add__ to be associative, so this should not be used as a general sum replacement. But if you know that you're adding floating point numbers you can use whatever algorithm best fits you. Or use numpy arrays; I think they implement Kahan summatio

STL multimap

2008-05-05 Thread castironpi
Is multimap just a syntax-checked dictionary of mutable sequences? Is def( a ): a[:]= [x] a trick or part of the language? It looks pretty sharp in variable-width. -- http://mail.python.org/mailman/listinfo/python-list

Re: get the pid of a process with pexpect

2008-05-05 Thread Nick Craig-Wood
Karim Bernardet <[EMAIL PROTECTED]> wrote: > Hi > > I am using pexpect to do ssh tunneling and to open a vnc server (jobs on > a grid cluster). When the job is canceled, these 2 processes remain on > the worker node (they are detached), so I have to kill them (using a > trap command in the

Re: Script using generators produces different results when invoked as a CGI

2008-05-05 Thread Nick Craig-Wood
Gabriel Genellina <[EMAIL PROTECTED]> wrote: > En Mon, 05 May 2008 00:31:45 -0300, Barclay, Ken <[EMAIL PROTECTED]> > escribió: > > > I attended David Beazley's awe-inspiring tutorial on the use of > > generators in systems programming: > >http://www.dabeaz.com/generators/ > > http://www.dabeaz.

Re: How to pass a multiline arg to exec('some.exe arg')?

2008-05-05 Thread Ian Kelly
> btw, is it necessarily to close() osql[1] in order to get res? > without close() the script seems is waiting for smth. > I'd like to get "res" in a loop: > write() > read() > write() > read() > ... > is it possible? Yes, call flush() each time you're done writing. -- http://mail.python.

Re: [Twisted-Python] Counting errors in a DeferredList and avoiding Unhandled error in Deferred messages

2008-05-05 Thread Jean-Paul Calderone
On Mon, 5 May 2008 19:10:39 +0200, Terry Jones <[EMAIL PROTECTED]> wrote: If I pass a list of deferreds to DeferredList and want to add a callback to the DeferredList to look at whatever errors have occurred in the underlying deferreds, should I do something like this: deferreds = [] for x in

Visual Studio 6 compile of 2.5.2 fails with missing db.h

2008-05-05 Thread brucoder
Hi Folks, Searched the archives, but I can only find mention of db.h problems relating to Linux. I've downloaded the source for 2.5.2 and am trying to compile it in Visual Studio 6 (SP6). The error reports read: Configuration: _bsddb - Win32 Debug Compili

Re: generator functions in another language

2008-05-05 Thread J. Cliff Dyer
On Mon, 2008-05-05 at 10:08 -0700, [EMAIL PROTECTED] wrote: > At some point, code goes "on" and "off" the processor, which knowledge > I do owe to spending money. Thus, if the group news is a localcy > (other dimension of currency), that's bounce check the house dollar. > What do [second person pl

cgitb performance issue

2008-05-05 Thread Ethan Furman
Greetings! I tried adding a form to our website for uploading large files. Personally, I dislike the forms that tell you you did something wrong and make you re-enter *all* your data again, so this one cycles and remembers your answers, and only prompts for the file once the rest of the ente

Re: unicode newbie - printing mixed languages to the terminal

2008-05-05 Thread David
> I suggest you read http://www.amk.ca/python/howto/unicode to demystify what > Unicode is and does, and how to use it in Python. That document really helped. This page helped me to setup the console:http://www.jw-stumpel.nl/stestu.html#T3 I ran: dpkg-reconfigure locales # And enabled a en_ZA.

Re: So you think PythonCard is old? Here's new wine in an old bottle.

2008-05-05 Thread jbarciela
John, you are the man > during my search for perfection, I found Qooxdoo (http://qooxdoo.org/). > > ... > > I found QxTransformer > (http://sites.google.com/a/qxtransformer.org/qxtransformer/Home) which is a > XSLT toolkit that creats XML code that invoke qooxdoo. Qooxdoo is indeed really impres

Re: SSL through python. possible ?

2008-05-05 Thread TkNeo
On May 2, 1:52 pm, Mike Driscoll <[EMAIL PROTECTED]> wrote: > On May 2, 1:20 pm, Heikki Toivonen <[EMAIL PROTECTED]> wrote: > > > Mike Driscoll wrote: > > > On Apr 29, 8:56 am,TkNeo<[EMAIL PROTECTED]> wrote: > > >> I need to do SSL file transfer using python? Is there a library i can > > >> use ? >

Re: ]ANN[ Vellum 0.16: Lots Of Documentation and Watching

2008-05-05 Thread Ville M. Vainio
"Zed A. Shaw" <[EMAIL PROTECTED]> writes: > GPLv3? > > How do people feel about Vellum's GPLv3 status? It actually doesn't > impact anyone unless you embed Vellum into a project/product or you Yeah, but it effectively prevents people from embedding it into their apps that wish to remain BSD/MIT

Re: So you think PythonCard is old? Here's new wine in an old bottle.

2008-05-05 Thread Daniel Fetchinson
> > For serveral years, I have been looking for a way to migrate away from > desktop GUI/client-server programming onto the browser based network > computing model of programming. Unfortunately, up until recently, > browser based programs are very limited - due to the limitation of > HTML itself.

Re: How do I say "Is this a function"?

2008-05-05 Thread Fabiano Sidler
John Henry schrieb: exec fct You don't want this. You want to store the function in a list instead: l = [ f1, f3, others ] for i in [0,1]: l[i]() Greetings, Fabiano -- http://mail.python.org/mailman/listinfo/python-list

need help of regular expression genius

2008-05-05 Thread RJ vd Oest
-- http://mail.python.org/mailman/listinfo/python-list

psycopg2 ReferenceManual

2008-05-05 Thread David Anderson
Hi all, where can I find the reference manual from the psycopg2 or the dbapi2.0 because in their official pages I could'nt find thx -- http://mail.python.org/mailman/listinfo/python-list

listing computer hard drives with python

2008-05-05 Thread Ohad Frand
Hi I am looking for a way to get a list of all active logical hard drives of the computer (["c:","d:"..]) Thanks, Ohad -- http://mail.python.org/mailman/listinfo/python-list

Re: Best way to store config or preferences in a multi-platform way.

2008-05-05 Thread python
Lance, > I am still undecided if the ability for the user to edit the file > independently of the program is a good or bad thing. I prefer user viewable plain (non-XML) text files because: - easy to make a change in case of emergency - easy to visually review and search - easy to version contro

Re: STL multimap

2008-05-05 Thread Aaron Watters
Hi there. Maybe a little more context would help us figure out what you want here... On May 5, 1:28 pm, [EMAIL PROTECTED] wrote: > Is multimap just a syntax-checked dictionary of mutable sequences? I think the equivalent of a multimap can be implemented several different ways, depending on what

os.open and O_EXCL

2008-05-05 Thread Ethan Furman
Greetings! I am trying to lock a file so no other process can get read nor write access to it. I thought this was possible with os.open(filename, os.O_EXCL), but that is not working. I am aware of the win32file option to do file locking, so my question is this: what is the purpose of the o

Re: Best way to store config or preferences in a multi-platform way

2008-05-05 Thread python
Lance, > I am still undecided if the ability for the user to edit the file > independently of the program is a good or bad thing. I prefer user viewable plain (non-XML) text files because: - easy to make a change in case of emergency - easy to visually review and search - easy to version contro

Writing elapsed time as a string

2008-05-05 Thread Simon Pickles
Hello. I'm sorry if this has been asked a thousand (million) times. Is there a nifty pythonesque way to produce a string representing an elapsed time period, in terms of years, months, days, hours, mins, seconds? I am storing times in a MySQL db, and would love to be able to write the time e

Writing elapsed time as a string

2008-05-05 Thread Simon Pickles
Hello. I'm sorry if this has been asked a thousand (million) times. Is there a nifty pythonesque way to produce a string representing an elapsed time period, in terms of years, months, days, hours, mins, seconds? I am storing times in a MySQL db, and would love to be able to write the time e

Re: Preventing 'bad' filenames from raising errors in os.path

2008-05-05 Thread python
Matimus and John, Thank you both for your feedback. Matimus: I agree with your analysis. I blame lack of caffeine for my original post :) Regards, Malcolm -- http://mail.python.org/mailman/listinfo/python-list

Re: ISBN Barecode reader in Python?

2008-05-05 Thread Max Erickson
Nick Craig-Wood <[EMAIL PROTECTED]> wrote: > Joseph <[EMAIL PROTECTED]> wrote: >> All: I have written a program to query Amazon with ISBN and get >> the book details. I would like to extend so that I can read >> ISBN from the barcode (I will take a photo of the same using >> webcam or mobile).

Re: [ANN] Vellum 0.16: Lots Of Documentation and Watching

2008-05-05 Thread Ville M. Vainio
[EMAIL PROTECTED] writes: > I didn't find your language offensive but you might consider toning down > your review of the Awesome Window Manager :) Nah - keep up the bad attitude. Your (Zed) blog/articles are one of the few things on the programmosphere that actually make me laugh audibly. -- ht

Re: Visual Studio 6 compile of 2.5.2 fails with missing db.h

2008-05-05 Thread brucoder
On May 5, 11:43 am, brucoder <[EMAIL PROTECTED]> wrote: > Hi Folks, > > Searched the archives, but I can only find mention of db.h problems relating > to Linux. > > I've downloaded the source for 2.5.2 and am trying to compile it in Visual > Studio 6 (SP6). I've just stepped back to 2.3.7 and re

Re: ISBN Barecode reader in Python?

2008-05-05 Thread Ville M. Vainio
Max Erickson <[EMAIL PROTECTED]> writes: > The killer application for ISBN lookup on Amazon is checking prices > while in the bookstore. Being able to email a photo from your phone > and then getting an email with the Amazon price in response would be > way easier than typing the isbn into Goo

Re: Are rank noobs tolerated, here?

2008-05-05 Thread notbob
On 2008-05-04, notbob <[EMAIL PROTECTED]> wrote: > I'm trying to learn how to program. I'm using: > > How to Think Like a Computer Scientist > > Learning with Python > 2nd Edition http://openbookproject.net//thinkCSpy/index.xhtml OK then, using the above, I get everything up till chap 3 and

Re: generator functions in another language

2008-05-05 Thread [EMAIL PROTECTED]
On May 4, 1:11 pm, [EMAIL PROTECTED] wrote: > There is no such thing as a 'frame' per se in C; byte code is > integral. As there is no such thing as suspended state without > frames, and no such thing as generators without suspended state. Well, for implementing generators there are alternatives

Re: confused about self, why not a reserved word?

2008-05-05 Thread Terry Reedy
"globalrev" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | sorry i noticed now a little error, i was playing around a lot and saw | that on the sel-example i had then called foo.hello() instead of | foo.Hello(). Lesson: whenever one inquires about an 'error', one should cut and pa

  1   2   >