Re: Data structure recommendation?

2008-04-07 Thread Paul McGuire
On Apr 7, 3:58 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > > I believe the best way to implement this would be a binary search > (bisect?) on the actual times, which would be O(log N). bisect is definitely the way to go. You should take care with floating point precision, though. One way to do

Re: troll poll

2008-04-07 Thread Aahz
In article <[EMAIL PROTECTED]>, alex23 <[EMAIL PROTECTED]> wrote: >(Aahz) wrote: >> alex23 wrote: >>> >>>The usual >>>response to complaining about the lack of a killfile for Google Groups >>>has been "use a decent client", but as I'm constantly moving between >>>machines having a consistent app f

Re: Recursively Backup Directories

2008-04-07 Thread Aahz
In article <[EMAIL PROTECTED]>, Jorgen Grahn <[EMAIL PROTECTED]> wrote: > >I believe it is better to write a script which drives a widely known >and well-tested copying utility. On Unix these include tar, cpio and >rsync -- don't know which ones are common under DOS (xcopy?) Just use pax (I haven

Re: popen pipe limit

2008-04-07 Thread Gabriel Genellina
En Mon, 07 Apr 2008 20:52:54 -0300, skunkwerk <[EMAIL PROTECTED]> escribió: > I'm getting errors when reading from/writing to pipes that are fairly > large in size. To bypass this, I wanted to redirect output to a file > in the subprocess.Popen function, but couldn't get it to work (even > afte

Re: A funnily inconsistent behavior of int and float

2008-04-07 Thread Mark Dickinson
On Apr 7, 4:59 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > "Mark Dickinson" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > Thank you for the corrections. Here is my revised proposal: > > int([number | string[, radix]) > ... Excellent! It looks to me as though this covers e

Re: A funnily inconsistent behavior of int and float

2008-04-07 Thread Terry Reedy
"Mark Dickinson" <[EMAIL PROTECTED]> wrote in message | Excellent! | It looks to me as though this covers everything. I'm tempted to | quibble about exact wordings, but probably the most productive thing to do | would be just to submit this to bugs.python.org and then let Georg Brandl | work his

Re: pyAmazon

2008-04-07 Thread steve
I noticed it's happening at the line that does the parsing: dom = minidom.parse(usock), in pyaws/ecs.py I'll look into how to turn off the outputting. On Apr 7, 4:20 pm, steve <[EMAIL PROTECTED]> wrote: > Anyone familiar with pyAmazon ( the latest for AWS 4

Re: Translating keywords

2008-04-07 Thread Gabriel Genellina
En Mon, 07 Apr 2008 14:59:08 -0300, Terry Reedy <[EMAIL PROTECTED]> escribió: > "Ronn Ross" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > | This is my first post and I'm new to Python. How would someone go about > | adding keywords to Python? It would be great to add support for

python, Mysql_python, storm problem

2008-04-07 Thread paul Batoum.
I am actually tryng to build a database apps in python + storm which use MySQLdb 1.2.2 i actually want the auto reconnect feature of storm, which just need to change the False param of raw_connect to True in storm/databases/mysql.py so far nothing really difficult but from there i got quite a weir

Re: read large zip file

2008-04-07 Thread John Nagle
Gabriel Genellina wrote: > En Sun, 06 Apr 2008 19:20:31 -0300, Brian Blais <[EMAIL PROTECTED]> > escribió: > >> I need to read a series of large zipfiles (which only contain one >> large text file), and I noticed that the zipfile module: >> >> 1) has a read method which isn't an iterator, and ret

guide through python interpreter source code

2008-04-07 Thread Avi Kohn
Are there documents,books, articles that can introduce me to the python source code base ? Thank you! Avi -- http://mail.python.org/mailman/listinfo/python-list

Re: Help replacing os.system call with subprocess call

2008-04-07 Thread David Pratt
Hi Matt. My apologies, I was away a good part of the day and evening today. Here are the numbers for the different methods: original os.system call: 29.685759 s buffered stdout call:213.370982 s (with 1mb buffer) direct to stdout call:33.378756 s The second method worked great and is e

ImportError: No module named MySQLdb

2008-04-07 Thread syed mehdi
Hi Guys, I have been working in python from some time now, while writing a python script i used: import MySQLdb in my script to do some database related operations. When i tried to execute the same script on another system it gave me an error as: "ImportError: No module named MySQLdb" though mysqld

Newbie: How to pass a dictionary to a function?

2008-04-07 Thread BonusOnus
How do I pass a dictionary to a function as an argument? # Say I have a function foo... def foo (arg=[]): x = arg['name'] y = arg['len'] s = len (x) t = s + y return (s, t) # The dictionary: dict = {} dict['name'] = 'Joe Shmoe' dict['len'] = 44 # I try to pass the dictionary as an argument

Re: Newbie: How to pass a dictionary to a function?

2008-04-07 Thread Ricky Zhou
On 2008-04-07 08:54:09 PM, BonusOnus wrote: > How do I pass a dictionary to a function as an argument? > > > # Say I have a function foo... > def foo (arg=[]): Try: def foo(arg={}): Thanks, Ricky pgpXEZLwP4mLj.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-l

Re: Adding Images To MySQL

2008-04-07 Thread Gabriel Genellina
En Mon, 07 Apr 2008 15:17:26 -0300, Victor Subervi <[EMAIL PROTECTED]> escribió: >> sql = "insert into PRODUCTS (PRODID, NAME, DESCRIPTION) " \ >> "values (%s,%s,%s);" >> cursor.execute(sql, (prodid, prodname, description)) >> >> and it works fine. >> >> Note that execute has t

Re: Newbie: How to pass a dictionary to a function?

2008-04-07 Thread Matt Nordhoff
BonusOnus wrote: > How do I pass a dictionary to a function as an argument? > > > # Say I have a function foo... > def foo (arg=[]): > x = arg['name'] > y = arg['len'] > > s = len (x) > > t = s + y > > return (s, t) I assume you actually indented the body of the function? > # The dictionary:

Re: Newbie: How to pass a dictionary to a function?

2008-04-07 Thread Dan Bishop
On Apr 7, 10:54 pm, BonusOnus <[EMAIL PROTECTED]> wrote: > How do I pass a dictionary to a function as an argument? The same way you pass any other argument. > # Say I have a function foo... > def foo (arg=[]): It's generally a bad idea to use [] as a default argument. > x = arg['name'] > y = a

Re: splitting an XML file on the basis on basis of XML tags

2008-04-07 Thread bijeshn
On Apr 7, 5:34 pm, Stefan Behnel <[EMAIL PROTECTED]> wrote: > bijeshn wrote: > > the extracted files are to be XML too. ijust need to extract it raw > > (tags and data just like it is in the parent XML file..) > > Ah, so then replace the "print tostring()" line in my example by > >     ET.ElementTr

Re: guide through python interpreter source code

2008-04-07 Thread Terry Reedy
"Avi Kohn" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Are there documents,books, articles that can introduce me to the python | source code base ? This has been asked before. The general answer has been to look at the code. Perhaps you can find some of the more specific an

Re: read large zip file

2008-04-07 Thread Gabriel Genellina
En Tue, 08 Apr 2008 00:10:01 -0300, John Nagle <[EMAIL PROTECTED]> escribió: > Gabriel Genellina wrote: >> En Sun, 06 Apr 2008 19:20:31 -0300, Brian Blais <[EMAIL PROTECTED]> >> escribió: >> >>> I need to read a series of large zipfiles (which only contain one >>> large text file), and I noticed

Re: Translating keywords

2008-04-07 Thread Terry Reedy
"Gabriel Genellina" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | En Mon, 07 Apr 2008 14:59:08 -0300, Terry Reedy <[EMAIL PROTECTED]> | escribió: | > If you want other-language keywords, you should either use a translator | > processor or an editor that will do keyword substitutio

Re: ImportError: No module named MySQLdb

2008-04-07 Thread Gabriel Genellina
En Tue, 08 Apr 2008 00:35:29 -0300, syed mehdi <[EMAIL PROTECTED]> escribió: > I have been working in python from some time now, > while writing a python script i used: import MySQLdb in my script to do > some > database related operations. > When i tried to execute the same script on another

Re: Newbie: How to pass a dictionary to a function?

2008-04-07 Thread Jason Scheirer
On Apr 7, 8:54 pm, BonusOnus <[EMAIL PROTECTED]> wrote: > How do I pass a dictionary to a function as an argument? > > # Say I have a function foo... > def foo (arg=[]): > x = arg['name'] > y = arg['len'] > > s = len (x) > > t = s + y > > return (s, t) > > # The dictionary: > > dict = {} > dict['na

Re: Newbie: How to pass a dictionary to a function?

2008-04-07 Thread Brian
Plus you probably don't want to set [] as default argument and then try to access it like a dictionary; you'll get an exception if you ever call just foo(), with no argument. On Tue, Apr 8, 2008 at 12:57 AM, Jason Scheirer <[EMAIL PROTECTED]> wrote: > On Apr 7, 8:54 pm, BonusOnus <[EMAIL PROTECTE

Re: Newbie: How to pass a dictionary to a function?

2008-04-07 Thread Gabriel Genellina
En Tue, 08 Apr 2008 00:54:09 -0300, BonusOnus <[EMAIL PROTECTED]> escribió: > How do I pass a dictionary to a function as an argument? The indentation is lost, so it's not easy to check your program. > # Say I have a function foo... Original: def foo(arg=[]). An empty list isn't a good defaul

Re: Newbie: How to pass a dictionary to a function?

2008-04-07 Thread Gabriel Genellina
En Tue, 08 Apr 2008 01:57:47 -0300, Jason Scheirer <[EMAIL PROTECTED]> escribió: > You want to > return s, t > NOT return (s, t) -- this implicitly only returns ONE item To avoid confusing the poor newbie: No, they're absolutely the same thing, in both cases you're returning a tuple with two

Re: ImportError: No module named MySQLdb

2008-04-07 Thread syed mehdi
Thanks Gabriel, it worked after installing MySQL (database engine). Regards Syed On Tue, Apr 8, 2008 at 10:23 AM, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > En Tue, 08 Apr 2008 00:35:29 -0300, syed mehdi <[EMAIL PROTECTED]> > escribió: > > > I have been working in python from some time now, >

Re: A file iteration question/problem

2008-04-07 Thread Arnaud Delobelle
On Apr 7, 11:40 pm, John Nagle <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > I want to iterate through the lines of a file in a recursive function > > so I can't use:- > > >     f = open(listfile, 'r') > >     for ln in f: > > > because when the function calls itself it won't see any mo

Re: Welcome to the "Python-list" mailing list

2008-04-07 Thread Paul McGuire
On Apr 7, 9:54 am, Steve Holden <[EMAIL PROTECTED]> wrote: > Ronn Ross wrote: > > This is my first post and I'm new to Python. How would someone go about > > adding keywords to Python? It would be great to add support for > > Esperanto keywords in the language instead of English being the only > >

Re: Translating keywords

2008-04-07 Thread Arnaud Delobelle
On Apr 8, 3:47 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > Python 3 allows for unicode identifiers, but I don'k know any plans for   > using unicode keywords too. Looks funny: > > ∀ x ∈ values: >    if x ∉ forbidden ∧ x ≠ y: >      print(x, Γ(x), √(x)) > print(∑(values)) > near = λ a,b,ε=0

Re: reading dictionary's (key,value) from file

2008-04-07 Thread Raymond Hettinger
On Apr 7, 9:38 am, [EMAIL PROTECTED] wrote: > Folks, > Is it possible to read hash values from txt file. > I have script which sets options. Hash table has key set to option, > and values are option values. > > Way we have it, we set options in a different file (*.txt), and we > read from that file

Re: Translating keywords

2008-04-07 Thread Torsten Bronger
Hallöchen! Gabriel Genellina writes: > [...] > > Python 3 allows for unicode identifiers, but I don'k know any > plans for using unicode keywords too. Looks funny: > > ∀ x ∈ values: > if x ∉ forbidden ∧ x ≠ y: > print(x, Γ(x), √(x)) > print(∑(values)) > near = λ a,b,ε=0.01: a-ε ≤ b ≤ a+ε A

Re: Learning curve for new database program with Python?

2008-04-07 Thread CM
On Apr 7, 1:19 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On 7 avr, 07:34, CM <[EMAIL PROTECTED]> wrote: > > > > > On Apr 5, 11:50 am, Jetus <[EMAIL PROTECTED]> wrote: > > > > I have a need for a database program. I downloaded the db2 from ibm, > > > and reviewed some of the documentation

Re: Translating keywords

2008-04-07 Thread Arnaud Delobelle
On Apr 8, 6:47 am, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: [...] > Although I would use ∀ and ∃ as aliases for all() > and exists() :) I mean all() and any() of course -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list

Re: Translating keywords

2008-04-07 Thread Gabriel Genellina
En Tue, 08 Apr 2008 03:03:13 -0300, Torsten Bronger <[EMAIL PROTECTED]> escribió: > Gabriel Genellina writes: >> >> Python 3 allows for unicode identifiers, but I don'k know any >> plans for using unicode keywords too. Looks funny: >> >> ∀ x ∈ values: >> if x ∉ forbidden ∧ x ≠ y: >> print(

Re: Translating keywords

2008-04-07 Thread Gabriel Genellina
En Tue, 08 Apr 2008 03:28:54 -0300, Arnaud Delobelle <[EMAIL PROTECTED]> escribió: > On Apr 8, 6:47 am, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > [...] >> Although I would use ∀ and ∃ as aliases for all() >> and exists() :) > > I mean all() and any() of course Yes, I thought about that usag

<    1   2