Re: use str as variable name

2008-09-05 Thread Michele Simionato
On Sep 6, 8:02 am, "Marco Bizzarri" <[EMAIL PROTECTED]> wrote: > On Fri, Sep 5, 2008 at 9:16 PM, Bruno Desthuilliers > > <[EMAIL PROTECTED]> wrote: > > Marco Bizzarri a écrit : > > >> Just a question: "generic functions" are not meant in the sense of > >> "generic functions" of CLOS, am I right? >

Re: use str as variable name

2008-09-05 Thread Marco Bizzarri
On Sat, Sep 6, 2008 at 7:52 AM, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Marco Bizzarri wrote: > >>> (...as Bruno implies, setattr(), len() et al can be and should be viewed >>> as >>> generic functions. >> >> Just a question: "generic functions" are not meant in the sense of >> "generic function

Re: use str as variable name

2008-09-05 Thread Marco Bizzarri
On Fri, Sep 5, 2008 at 9:16 PM, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Marco Bizzarri a écrit : >> >> Just a question: "generic functions" are not meant in the sense of >> "generic functions" of CLOS, am I right? > > Nope. Just "generic" in the sense that they accept any object implementi

Re: use str as variable name

2008-09-05 Thread Fredrik Lundh
Marco Bizzarri wrote: (...as Bruno implies, setattr(), len() et al can be and should be viewed as generic functions. Just a question: "generic functions" are not meant in the sense of "generic functions" of CLOS, am I right? it's meant in exactly that sense: len(L) means "of all len() imple

Re: max(), sum(), next()

2008-09-05 Thread castironpi
On Sep 5, 9:20 pm, "Manu Hack" <[EMAIL PROTECTED]> wrote: > On Fri, Sep 5, 2008 at 1:04 PM, castironpi <[EMAIL PROTECTED]> wrote: > > On Sep 5, 3:28 am, "Manu Hack" <[EMAIL PROTECTED]> wrote: > >> On Thu, Sep 4, 2008 at 4:25 PM, castironpi <[EMAIL PROTECTED]> wrote: > >> > On Sep 4, 2:42 pm, [EMAIL

Re: max(), sum(), next()

2008-09-05 Thread Manu Hack
On Fri, Sep 5, 2008 at 11:45 PM, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Fri, 05 Sep 2008 22:20:06 -0400, Manu Hack wrote: > >> On Fri, Sep 5, 2008 at 1:04 PM, castironpi <[EMAIL PROTECTED]> wrote: > ... >The reason sum([]) is 0 is that sum( [ x ] ) - x = 0. It doesn't make s

Re: max(), sum(), next()

2008-09-05 Thread Steven D'Aprano
On Fri, 05 Sep 2008 22:20:06 -0400, Manu Hack wrote: > On Fri, Sep 5, 2008 at 1:04 PM, castironpi <[EMAIL PROTECTED]> wrote: ... >>> >The reason sum([]) is 0 is that sum( [ x ] ) - x = 0. >>> >>> It doesn't make sense to me. What do you set x to? >> >> For all x. > > But then how can you conclud

embed python in ms-word?

2008-09-05 Thread oyster
In my ms-word documnet, there are some calculation whihc I have to change due to different argumnet. is there any way to embed python code in word, so that I can write the following as a macro or something else, then the result (i.e. 2) is shown in the word documnet? def f(n): if n<2: return

Re: indices question

2008-09-05 Thread Lanny
> Lanny: >> ... >> varcc = raw_input >> grid[varc] = 'O' >> ... >> Why can't I put a varible thats an integer instead? > > 'varcc' and 'varc' are different names. > > 'raw_input' isn't a function call, you may want to turn that into a > function call. > > varc isn't an integer, you

Re: max(), sum(), next()

2008-09-05 Thread Manu Hack
On Fri, Sep 5, 2008 at 1:04 PM, castironpi <[EMAIL PROTECTED]> wrote: > On Sep 5, 3:28 am, "Manu Hack" <[EMAIL PROTECTED]> wrote: >> On Thu, Sep 4, 2008 at 4:25 PM, castironpi <[EMAIL PROTECTED]> wrote: >> > On Sep 4, 2:42 pm, [EMAIL PROTECTED] wrote: >> >> David C. Ullrich: >> >> >> > At least in

Re: running python as a dameon

2008-09-05 Thread Sean Davis
On Sep 5, 5:55 pm, peyman <[EMAIL PROTECTED]> wrote: > Hi > > I have a Natural Language Processing (NLP) code written in python that > reads into memory a large training file and then given a sentence tags > it, using the training data. I want to put this NLP code on a server > which handles all in

Re: max(), sum(), next()

2008-09-05 Thread Steven D'Aprano
On Fri, 05 Sep 2008 10:22:22 -0500, David C. Ullrich wrote about why max and min shouldn't accept a default argument: > Think about all the previously elected female or black presidents of the > US. Which one was the tallest? I know the answer to that one: All of them! -- Steven -- http://

Re: Files application architecture

2008-09-05 Thread Bruno Desthuilliers
Benjamin Watine a écrit : Hi, I'm about to develop a small python application and I wonder how to organize files in this application. I'm familar to java, so I'm tempted to use the same convention http://dirtsimple.org/2004/12/python-is-not-java.html : 1 file per class and 1 folders per pa

Re: Can anyone suggest a good crypto package?

2008-09-05 Thread Paul Rubin
Fett <[EMAIL PROTECTED]> writes: > I am having trouble seeing how I would post the encrypted data to a > website and get it back without it changing some. I don't understand why it would change. I'm a little confused though, I didn't realize you wanted to post the data to a web site. What exact

Re: Understanding the pythonic way: why a.x = 1 is better than a.setX(1) ?

2008-09-05 Thread Ivan Illarionov
On 5 сент, 19:23, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Ivan Illarionov schrieb: > > > > > On 4 сент, 21:49, Bruno Desthuilliers > > <[EMAIL PROTECTED]> wrote: > >> Ivan Illarionov a écrit : > > >>> On 4 сент, 22:59, Carl Banks <[EMAIL PROTECTED]> wrote: > You can write code to guard

Re: indices question

2008-09-05 Thread bearophileHUGS
Lanny: > ... > varcc = raw_input > grid[varc] = 'O' > ... > Why can't I put a varible thats an integer instead? 'varcc' and 'varc' are different names. 'raw_input' isn't a function call, you may want to turn that into a function call. varc isn't an integer, you may have to conver

Re: hashing an array - howto

2008-09-05 Thread John Machin
On Sep 6, 9:30 am, John Machin <[EMAIL PROTECTED]> wrote: > On Sep 6, 7:49 am, [EMAIL PROTECTED] wrote: > > > John Machin: > > > > Consider this:>>> hash(123) == hash(123.0) == hash(123L) > > > True > > > Right... Can you explain me why Python designers have chosen to build > > a hash() like that?

Re: indices question

2008-09-05 Thread Christian Heimes
Lanny wrote: Please don't tell me that "list indices must be integers" because I know that, Why can't I put a varible thats an integer instead? raw_input() always returns a string. You have to convert the string into an integer using int(). Christian -- http://mail.python.org/mailman/list

indices question

2008-09-05 Thread Lanny
pretty self-explanatory, here's what I put in: while stat == 0 : pgrid#ignore, A pre-defined function print "what cell do you want?" varcc = raw_input grid[varc] = 'O' And here's what I get back: Traceback (most recent call last): File "C:\py_prog\Ti

Re: hashing an array - howto

2008-09-05 Thread John Machin
On Sep 6, 7:49 am, [EMAIL PROTECTED] wrote: > John Machin: > > > Consider this:>>> hash(123) == hash(123.0) == hash(123L) > > True > > Right... Can you explain me why Python designers have chosen to build > a hash() like that? I can't channel them; my rationalisation is this: Following the Law of

Re: sqlite3 import performance

2008-09-05 Thread Gerhard Häring
Ben Lee wrote: > hi folks -- > > a quick python and sqlite3 performance question. i find that > inserting a million rows of in-memory data into an in-memory database > via a single executemany() is about 30% slower than using the sqlite3 > CLI and the .import command (reading the same data from a

Re: Make Games

2008-09-05 Thread Chris Babcock
> I want to learn Python so I can make simple games. What are some good > books that'll help me do this? I promise that I'm not posting this to be a 81+<#: http://www.amazon.com/s/ref=nb_ss_gw?url=search-alias%3Daps&field-keywords=python+game Chris -- http://mail.python.org/mailman/listinfo/pyt

Re: Files application architecture

2008-09-05 Thread Gabriel Genellina
En Fri, 05 Sep 2008 12:53:12 -0300, Benjamin Watine <[EMAIL PROTECTED]> escribió: I'm about to develop a small python application and I wonder how to organize files in this application. I'm familar to java, so I'm tempted to use the same convention : 1 file per class and 1 folders per packa

running python as a dameon

2008-09-05 Thread peyman
Hi I have a Natural Language Processing (NLP) code written in python that reads into memory a large training file and then given a sentence tags it, using the training data. I want to put this NLP code on a server which handles all incoming client http requests via PHP. What I want to do is to pro

Re: hashing an array - howto

2008-09-05 Thread bearophileHUGS
John Machin: > Consider this:>>> hash(123) == hash(123.0) == hash(123L) > True Right... Can you explain me why Python designers have chosen to build a hash() like that? > Try "uses all the information that is relevant to the task". My knowledge of hash data structures seems not enough to unders

Re: Regarding subprocess module

2008-09-05 Thread Gabriel Genellina
En Fri, 05 Sep 2008 09:56:02 -0300, tarun <[EMAIL PROTECTED]> escribió: import subprocess,time cmdExe = "C:\\WINDOWS\\system32\\cmd.exe" myProcess = subprocess.Popen(cmdExe,stdin=subprocess.PIPE) time.sleep(2) myProcess.stdin.write('cd Desktop\r\n') I copied the above lines of code to a file

Re: Need formatting suggestion for long strings

2008-09-05 Thread Robert Dailey
On Fri, Sep 5, 2008 at 3:58 PM, Eric Wertman <[EMAIL PROTECTED]> wrote: > > I'm concerned about the formatting of the string in that I do not want > the > > way I split the string up in source code to affect the way the string is > > displayed to the console. In other words, in source, if I break

Re: pdb bug and questions

2008-09-05 Thread Stef Mientki
R. Bernstein wrote: Finally, I think rpdb2 is part of the winpdb project on Sourceforge and again has a bug tracker. My sense is that Nir Aides is very good about handling bugs reported in winpdb/rpdb. Yes I started with rpdb2, and indeed Nir Aides is very helpfull, but I think interfa

Re: [PIL] quake like multicoloured text

2008-09-05 Thread Gabriel Genellina
En Fri, 05 Sep 2008 16:24:08 -0300, Durand <[EMAIL PROTECTED]> escribió: I'm wondering how I could render text with PIL in which different parts of the text are different characters. This is for a game stats script where names are written like: ^1Red ^2Green ^3Yellow, etc. The problem is that I

Re: Determining Processor Vender

2008-09-05 Thread John Machin
On Sep 6, 5:07 am, aha <[EMAIL PROTECTED]> wrote: > On Sep 5, 3:00 pm, aha <[EMAIL PROTECTED]> wrote: > > > Dose anyone know of a cross-platform method for determining the vendor > > of a processor?  Under linux I can check /proc/cpuinfo.  What I'd like > > to be able to do is determine if a proces

Re: use str as variable name

2008-09-05 Thread Bruno Desthuilliers
Marco Bizzarri a écrit : On Thu, Sep 4, 2008 at 10:47 AM, Fredrik Lundh <[EMAIL PROTECTED]> wrote: (...as Bruno implies, setattr(), len() et al can be and should be viewed as generic functions. Just a question: "generic functions" are not meant in the sense of "generic functions" of CLOS, am

Re: pdb bug and questions

2008-09-05 Thread R. Bernstein
Stef Mientki <[EMAIL PROTECTED]> writes: > From: Stef Mientki <[EMAIL PROTECTED]> > Subject: Re: pdb bug and questions > Newsgroups: comp.lang.python > To: "python-list@python.org" > Date: Fri, 05 Sep 2008 22:06:19 +0200 > > R. Bernstein wrote: >> Stef Mientki <[EMAIL PROTECTED]> writes: >> >>

Re: hashing an array - howto

2008-09-05 Thread John Machin
On Sep 6, 2:45 am, [EMAIL PROTECTED] wrote: > Michael Palmer: > > > why can't it be tuple already? > > Because if the input list L has tuples and lists, they end having the > same hash value: Perhaps the OP shouldn't be constructing the hash of a mutable object. Perhaps he would be grateful if his

Re: Need formatting suggestion for long strings

2008-09-05 Thread Eric Wertman
> I'm concerned about the formatting of the string in that I do not want the > way I split the string up in source code to affect the way the string is > displayed to the console. In other words, in source, if I break up a single > string into multiple lines (using carriage returns), I would expect

Re: mimms problem on Hardy

2008-09-05 Thread kaer
On 5 sep, 22:15, kaer <[EMAIL PROTECTED]> wrote: > Hello, > > I installed (manually) the last version of mimms -which is a python > program- on an Ubuntu (8.04-server) box. > I get that: > > [EMAIL PROTECTED]:~/mimms-3.2$ mimms > Traceback (most recent call last): > File "/usr/bin/mimms", line 21

[ANN] pysqlite 2.5.0 released

2008-09-05 Thread Gerhard Häring
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 pysqlite 2.5.0 released === I'm pleased to announce the availability of pysqlite 2.5.0. This is a release with major new features. Go to http://pysqlite.org/ for downloads, online documentation and reporting bugs. What is pysqlit

Re: print doesn't respect file inheritance?

2008-09-05 Thread Ethan Furman
bukzor wrote: I was trying to change the behaviour of print (tee all output to a temp file) by inheriting from file and overwriting sys.stdout, but it looks like print uses C-level stuff to do its writes which bypasses the python object/inhertiance system. It looks like I need to use composition

Re: Case-insensitive string compare?

2008-09-05 Thread Robert Dailey
On Fri, Sep 5, 2008 at 12:36 PM, Fredrik Lundh <[EMAIL PROTECTED]>wrote: > Maric Michaud wrote: > > I suspect you are coming to conclusions a bit quickly, without taking the >> pain of understanding the whole discussion. >> > > I'm pretty sure I was the first one to post an answer in this thread,

Re: Case-insensitive string compare?

2008-09-05 Thread Ethan Furman
Maric Michaud wrote: Le Friday 05 September 2008 14:33:22 J. Clifford Dyer, vous avez écrit : On Thu, 2008-09-04 at 18:48 -0500, Robert Dailey wrote: Thanks everyone for your help. I'm not opposed to using [key.lower() for key in stage_map] at all, I was just curious to see if there were any

mimms problem on Hardy

2008-09-05 Thread kaer
Hello, I installed (manually) the last version of mimms -which is a python program- on an Ubuntu (8.04-server) box. I get that: [EMAIL PROTECTED]:~/mimms-3.2$ mimms Traceback (most recent call last): File "/usr/bin/mimms", line 21, in from libmimms.core import run File "/usr/lib/python2.

Re: Need formatting suggestion for long strings

2008-09-05 Thread Robert Dailey
On Fri, Sep 5, 2008 at 3:06 PM, aha <[EMAIL PROTECTED]> wrote: > Can you be more specific? What is the formatting criteria? Are you > talking about formatting the string for display or are you talking > about the source? Apologies for the confusion. My concern is both. Allow me to explain: I

Re: Happy fun time with SWIG

2008-09-05 Thread Uberman
Nobody has any help for me on this one? Let me see if I can make it clearer by using something simpler: +---+ ---| Peter |--- | +---+ | | | V V

Re: Need formatting suggestion for long strings

2008-09-05 Thread Robert Dailey
On Fri, Sep 5, 2008 at 2:29 PM, Jean-Paul Calderone <[EMAIL PROTECTED]>wrote: > mystring = ( > "This is a very long string that " > "spans multiple lines and does " > "not include line breaks or tabs " > "from the source file between " > "the strings partitions.") At first glance it lo

Re: Need formatting suggestion for long strings

2008-09-05 Thread aha
On Sep 5, 3:29 pm, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: > On Fri, 5 Sep 2008 14:24:16 -0500, Robert Dailey <[EMAIL PROTECTED]> wrote: > >Hi, > > >I find quite often that I'm writing things like this: > > >raise FatalExcept( "Insufficient number of arguments specified. Exactly {0} > >argum

Re: pdb bug and questions

2008-09-05 Thread Stef Mientki
R. Bernstein wrote: Stef Mientki <[EMAIL PROTECTED]> writes: hello, I'm trying to embed a debugger into an editor. I'm only interested in high level debugging. The first question is what debugger is the best for my purpose ? (pdb, pydb, rpdb2, smart debugger, extended debugger ? Second que

Re: quake like multicoloured text

2008-09-05 Thread Durand
Oops, I meant, "I'm wondering how I could render text with PIL in which different parts of the text are different *colours*." -- http://mail.python.org/mailman/listinfo/python-list

Re: Need formatting suggestion for long strings

2008-09-05 Thread Jean-Paul Calderone
On Fri, 5 Sep 2008 14:24:16 -0500, Robert Dailey <[EMAIL PROTECTED]> wrote: Hi, I find quite often that I'm writing things like this: raise FatalExcept( "Insufficient number of arguments specified. Exactly {0} arguments are required. See stage.bat for documentation on accepted parameters.".form

[PIL] quake like multicoloured text

2008-09-05 Thread Durand
I'm wondering how I could render text with PIL in which different parts of the text are different characters. This is for a game stats script where names are written like: ^1Red ^2Green ^3Yellow, etc. The problem is that I currently use text in the ImageDraw module but the only way I can think of r

Re: use str as variable name

2008-09-05 Thread Marco Bizzarri
On Thu, Sep 4, 2008 at 10:47 AM, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > (...as Bruno implies, setattr(), len() et al can be and should be viewed as > generic functions. Just a question: "generic functions" are not meant in the sense of "generic functions" of CLOS, am I right? -- Marco Biz

Need formatting suggestion for long strings

2008-09-05 Thread Robert Dailey
Hi, I find quite often that I'm writing things like this: raise FatalExcept( "Insufficient number of arguments specified. Exactly {0} arguments are required. See stage.bat for documentation on accepted parameters.".format( num_arguments ) ) On my display (Vertical monitor), this exceeds the widt

Re: "Full" element tag listing possible with Elementtree?

2008-09-05 Thread Carl Banks
On Sep 5, 2:27 am, [EMAIL PROTECTED] wrote: > So, for example, if I had a document that looked like this: > > >this is node b >this is node c > > this is node e > >this is node f > > > I would want to print the following: > > > > text: this is node b > > text:

Re: pdb bug and questions

2008-09-05 Thread R. Bernstein
Stef Mientki <[EMAIL PROTECTED]> writes: > hello, > > I'm trying to embed a debugger into an editor. > I'm only interested in high level debugging. > The first question is what debugger is the best for my purpose ? > (pdb, pydb, rpdb2, smart debugger, extended debugger ? > > Second question, in no

Re: Determining Processor Vender

2008-09-05 Thread aha
On Sep 5, 3:00 pm, aha <[EMAIL PROTECTED]> wrote: > Dose anyone know of a cross-platform method for determining the vendor > of a processor?  Under linux I can check /proc/cpuinfo.  What I'd like > to be able to do is determine if a processor is AMD or Intel, so that > I can use the appropriate num

Determining Processor Vender

2008-09-05 Thread aha
Dose anyone know of a cross-platform method for determining the vendor of a processor? Under linux I can check /proc/cpuinfo. What I'd like to be able to do is determine if a processor is AMD or Intel, so that I can use the appropriate numerical libraries for my application. Regards, Aquil -- h

Re: pdb bug and questions

2008-09-05 Thread R. Bernstein
castironpi <[EMAIL PROTECTED]> writes: > On Sep 4, 4:22 pm, Stef Mientki <[EMAIL PROTECTED]> wrote: >> hello, >> >> I'm trying to embed a debugger into an editor. >> I'm only interested in high level debugging. >> The first question is what debugger is the best for my purpose ? >> (pdb, pydb, rpdb

Re: xml + mmap cross

2008-09-05 Thread castironpi
On Sep 5, 12:13 am, Stefan Behnel <[EMAIL PROTECTED]> wrote: > Hi, > > this discussion seems pretty much off-topic for a Python list. > > > > castironpi wrote: > > In an XML file, entries are stored in serial, sort of like this. > > > AAA BBB CCC DDD > > > Or more recognizably, > > > somethingsomet

Re: PyGUI as a standard GUI API for Python?

2008-09-05 Thread Peter Decker
On Fri, Sep 5, 2008 at 10:48 AM, Diez B. Roggisch <[EMAIL PROTECTED]> wrote: > You got me wrong. I didn't say it doesn't use the native toolkit under > various OSes, I'm well aware of that it does. > > What I *did* say was that wx API is designed primarily with windows' toolkit > as base, and as a

sqlite3 import performance

2008-09-05 Thread Ben Lee
hi folks -- a quick python and sqlite3 performance question. i find that inserting a million rows of in-memory data into an in-memory database via a single executemany() is about 30% slower than using the sqlite3 CLI and the .import command (reading the same data from a disk file, even.) i find

Re: Make Games

2008-09-05 Thread David
NightZombie wrote: x-no-archive: yes I want to learn Python so I can make simple games. What are some good books that'll help me do this? -- http://mail.python.org/mailman/listinfo/python-list Good book you can get used; Python Programming for the Absolute Beginner http://books.google.com

Re: "Full" element tag listing possible with Elementtree?

2008-09-05 Thread jaime . dyson
On Sep 4, 11:43 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > > >   this is node b > >   this is node c > >     > >     this is node e > >   > >   this is node f > > > > > I would want to print the following: > > > > > > > text: this is node b > > > >

Re: max(), sum(), next()

2008-09-05 Thread Ken Starks
David C. Ullrich wrote: In article <[EMAIL PROTECTED]>, Ken Starks <[EMAIL PROTECTED]> wrote: David C. Ullrich wrote: I don't see why you feel the two should act the same. At least in mathematics, the sum of the elements of the empty set _is_ 0, while the maximum element of the empty set is

Re: max(), sum(), next()

2008-09-05 Thread Mensanator
On Sep 5, 1:08 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Thu, 4 Sep 2008 18:09:49 -0700 (PDT), Mensanator <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > > Too bad. I brought this up because I use Python a lot with > > database work and rarely for proving theorms

Re: Python and Cyrillic characters in regular expression

2008-09-05 Thread Fredrik Lundh
phasma wrote: string = u"Привет" (u'\u041f\u0440\u0438\u0432\u0435\u0442',) string = u"Hi.Привет" (u'Hi',) the [\w\s] pattern you used matches letters, numbers, underscore, and whitespace. "." doesn't fall into that category, so the "match" method stops when it gets to that character. ma

Re: Case-insensitive string compare?

2008-09-05 Thread Fredrik Lundh
Maric Michaud wrote: I suspect you are coming to conclusions a bit quickly, without taking the pain of understanding the whole discussion. I'm pretty sure I was the first one to post an answer in this thread, and I understand Python design and performance issues very well, thank you. (but g

Re: atomic section in code

2008-09-05 Thread Fredrik Lundh
Diez B. Roggisch wrote: AFAIC that kind of mutual exclusion is what atomicity is about. What else do you expect to happen? sounds like he wants/needs non-cooperative, mandatory locking. -- http://mail.python.org/mailman/listinfo/python-list

Documentation (was Re: atomic section in code)

2008-09-05 Thread Fredrik Lundh
Michele Simionato wrote: The page you link here is WAYS better than the standard documentation of the threading module. Generally speaking, the effbot zone contains a lot of improvements over the standard docs which are lacking in various areas. I have always wondered why they are kept separated

Re: max(), sum(), next()

2008-09-05 Thread castironpi
On Sep 5, 3:28 am, "Manu Hack" <[EMAIL PROTECTED]> wrote: > On Thu, Sep 4, 2008 at 4:25 PM, castironpi <[EMAIL PROTECTED]> wrote: > > On Sep 4, 2:42 pm, [EMAIL PROTECTED] wrote: > >> David C. Ullrich: > > >> > At least in mathematics, the sum of the elements of > >> > the empty set _is_ 0, while th

Re: hashing an array - howto

2008-09-05 Thread bearophileHUGS
Michael Palmer: > why can't it be tuple already? Because if the input list L has tuples and lists, they end having the same hash value: >>> L = [[1,2,3], (1,2,3)] >>> hash(tuple(L[0])), hash(tuple(L[1])) (-378539185, -378539185) But it's a not much common situation, and few hash collision pairs

Re: Files application architecture

2008-09-05 Thread Diez B. Roggisch
Benjamin Watine schrieb: Hi, I'm about to develop a small python application and I wonder how to organize files in this application. I'm familar to java, so I'm tempted to use the same convention : 1 file per class and 1 folders per package. I know that packages doesn't exists in python, the

Re: Retrieving the name of the class calling an instance method

2008-09-05 Thread Emile van Sebille
mercado mercado wrote: In Python, is it possible for an instance method to know the name of the class which is calling it? Well, the class name is in __class__ so changing 'print x' to 'print __class__' will show foo in both cases, which is in fact the name of the class which is calling i

Re: Retrieving the name of the class calling an instance method

2008-09-05 Thread Maric Michaud
Le Friday 05 September 2008 17:29:39 mercado mercado, vous avez écrit : > In Python, is it possible for an instance method to know the name of the > class which is calling it? For example, in the sample below, I would like > for the someMethod method to print the name of the class calling it ("bar"

Re: PyGUI as a standard GUI API for Python?

2008-09-05 Thread Todd Whiteman
M.-A. Lemburg wrote: A long time ago, there was a Python plugin for Netscape which allowed you to run Python straight in the browser. Perhaps it's time to revive such an idea... but then you're still missing out on the GUI part, since you're still stuck with what the browser has to offer in terms

Files application architecture

2008-09-05 Thread Benjamin Watine
Hi, I'm about to develop a small python application and I wonder how to organize files in this application. I'm familar to java, so I'm tempted to use the same convention : 1 file per class and 1 folders per package. I know that packages doesn't exists in python, they are modules instead. Ma

Re: Extract Information from Tables in html

2008-09-05 Thread Stefan Behnel
Hi, Jackie Wang wrote: > Here is a html code: > > > > Premier Community Bank of Southwest Florida > > Fort Myers, FL > > > > My question is how I can extract the strings and get the results: > Premier Community Bank of Southwest Florida; Fort Myers, FL Use lxml.h

Re: hashing an array - howto

2008-09-05 Thread Michael Palmer
On Sep 5, 11:18 am, [EMAIL PROTECTED] wrote: > Helmut Jarausch: > > > I need to hash arrays of integers (from the hash module). > > One of the possible solutions is to hash the equivalent tuple, but it > requires some memory (your sequence must not be tuples already): why can't it be tuple already

Re: PyGUI as a standard GUI API for Python?

2008-09-05 Thread Diez B. Roggisch
Peter Decker schrieb: On Wed, Sep 3, 2008 at 11:57 AM, Diez B. Roggisch <[EMAIL PROTECTED]> wrote: Michael Palmer schrieb: As anyone knows, the state of Python GUI programming is a little fractured at this time, with many toolkits, wrappers and meta-wrappers dead and alive, with or without docu

Re: [MacOS X] plat-mac/errors.rsrc.df.rsrc not installed/created

2008-09-05 Thread Christian Ebert
* Christian Ebert on Thursday, August 28, 2008: > I am on MacOS 10.4.11, and have a minor recurring problem, when > using my own Python installation. > > I only stumbled over it when using http operations with the > Mercurial SCM, and my /tmp/ folder was clobbered with *.rsrc > temporary files. >

Re: max(), sum(), next()

2008-09-05 Thread bearophileHUGS
David C. Ullrich: > I didn't mention what's below because it doesn't seem > likely that saying max([]) = -infinity and > min([]) = +infinity is going to make the OP happy... Well, it sounds cute having Neginfinite and Infinite as built-int objects that can be compared to any other type and are < o

Retrieving the name of the class calling an instance method

2008-09-05 Thread mercado mercado
In Python, is it possible for an instance method to know the name of the class which is calling it? For example, in the sample below, I would like for the someMethod method to print the name of the class calling it ("bar" in the first case, "again" in the second). -

Re: Understanding the pythonic way: why a.x = 1 is better than a.setX(1) ?

2008-09-05 Thread Diez B. Roggisch
Ivan Illarionov schrieb: > On 4 сент, 21:49, Bruno Desthuilliers > <[EMAIL PROTECTED]> wrote: >> Ivan Illarionov a écrit : >> >> >> >>> On 4 сент, 22:59, Carl Banks <[EMAIL PROTECTED]> wrote: You can write code to guard against this if you want: class A: legal = set(["x"])

Re: max(), sum(), next()

2008-09-05 Thread David C. Ullrich
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > David C. Ullrich: > > At least in mathematics, the sum of the elements of > > the empty set _is_ 0, while the maximum element of the > > empty set is undefined. > > What do you think about my idea of adding that 'default' argument to >

Re: Core dumped while interacting with OpenOffice.org via pyuno

2008-09-05 Thread Marco Bizzarri
On Fri, Sep 5, 2008 at 3:50 PM, Maric Michaud <[EMAIL PROTECTED]> wrote: > Le Friday 05 September 2008 15:04:22 Marco Bizzarri, vous avez écrit : >> Hi all. >> >> I'm experiencing a core dump while working in the following environment >> >> - debain etch >> - python2.3 >> - openoffice.org 2.4 >> -

Re: hashing an array - howto

2008-09-05 Thread bearophileHUGS
Helmut Jarausch: > I need to hash arrays of integers (from the hash module). One of the possible solutions is to hash the equivalent tuple, but it requires some memory (your sequence must not be tuples already): assert not isinstance(somelist, tuple) hash(tuple(somelist)) This is an alternative

Re: max(), sum(), next()

2008-09-05 Thread David C. Ullrich
In article <[EMAIL PROTECTED]>, Ken Starks <[EMAIL PROTECTED]> wrote: > David C. Ullrich wrote: > > > > > I don't see why you feel the two should act the same. > > At least in mathematics, the sum of the elements of > > the empty set _is_ 0, while the maximum element of the > > empty set is und

Re: PyGUI as a standard GUI API for Python?

2008-09-05 Thread Peter Decker
On Wed, Sep 3, 2008 at 11:57 AM, Diez B. Roggisch <[EMAIL PROTECTED]> wrote: > Michael Palmer schrieb: >> >> As anyone knows, the state of Python GUI programming is a little >> fractured at this time, with many toolkits, wrappers and meta-wrappers >> dead and alive, with or without documentation. >

Re: Can anyone suggest a good crypto package?

2008-09-05 Thread Fett
On Sep 4, 8:04 pm, Paul Rubin wrote: > If you just want to authenticate the strings without confidentiality, > use the built-in HMAC module. But beware of replay attacks. I looked into this and it looks like I might be able to get by with this. I didn't find this functi

Re: Extract Information from Tables in html

2008-09-05 Thread Peter Pearson
On Fri, 5 Sep 2008 11:35:14 -0300, Walter Cruz <[EMAIL PROTECTED]> wrote: > On Fri, Sep 5, 2008 at 11:29 AM, Jackie Wang <[EMAIL PROTECTED]> wrote: >> Here is a html code: >> >> >> >> Premier Community Bank of Southwest Florida >> >> Fort Myers, FL >> >> >> >> My question

Re: Make Games

2008-09-05 Thread Diez B. Roggisch
NightZombie schrieb: x-no-archive: yes I want to learn Python so I can make simple games. What are some good books that'll help me do this? Don't know about books, but I don't think it is important that the books are about python for game programming - game programming in general will help.

Re: hashing an array - howto

2008-09-05 Thread Peter Otten
Helmut Jarausch wrote: > I need to hash arrays of integers (from the hash module). > > So, I have to derive from array and supply a __hash__ method. > But how to hash an array (of fixed length, say 25)? > What I need is a function which maps a tuple of 25 integers > into 1 integer with good hashi

hashing an array - howto

2008-09-05 Thread Helmut Jarausch
Hi, I need to hash arrays of integers (from the hash module). So, I have to derive from array and supply a __hash__ method. But how to hash an array (of fixed length, say 25)? What I need is a function which maps a tuple of 25 integers into 1 integer with good hashing properties. Does anybody k

Make Games

2008-09-05 Thread NightZombie
x-no-archive: yes I want to learn Python so I can make simple games. What are some good books that'll help me do this? -- http://mail.python.org/mailman/listinfo/python-list

Re: Python test case management system?

2008-09-05 Thread Mudcat
> What would the behaviour of such a system be? In other words, what is > a "test case management system" in terms of the things that it does? The feature set for one tends to vary. In short it's a front end app which is tied to a db that stores and organizes test cases. The system will allow you

Re: Extract Information from Tables in html

2008-09-05 Thread Walter Cruz
On Fri, Sep 5, 2008 at 11:29 AM, Jackie Wang <[EMAIL PROTECTED]> wrote: > Dear all, > > Here is a html code: > > > > Premier Community Bank of Southwest Florida > > Fort Myers, FL > > > > My question is how I can extract the strings and get the results: > Premier Communit

Re: Case-insensitive string compare?

2008-09-05 Thread Maric Michaud
Le Friday 05 September 2008 16:00:39 J. Cliff Dyer, vous avez écrit : > Please keep the discussion on-list. > Sorry for the private email, I sent it again to the list.. > On Fri, 2008-09-05 at 15:36 +0200, Maric Michaud wrote: > > Le Friday 05 September 2008 14:33:22 J. Clifford Dyer, vous avez é

Extract Information from Tables in html

2008-09-05 Thread Jackie Wang
Dear all, Here is a html code: Premier Community Bank of Southwest Florida Fort Myers, FL My question is how I can extract the strings and get the results: Premier Community Bank of Southwest Florida; Fort Myers, FL Thanks a lot Jackie -- http://mail.python.org/

Re: Python and Cyrillic characters in regular expression

2008-09-05 Thread MRAB
On Sep 5, 12:28 pm, phasma <[EMAIL PROTECTED]> wrote: > string = u"ðÒÉ×ÅÔ" All the characters are letters. > (u'\u041f\u0440\u0438\u0432\u0435\u0442',) > > string = u"Hi.ðÒÉ×ÅÔ" The third character isn't a letter and isn't whitespace. > (u'Hi',) > > On Sep 4, 9:53špm, Fredrik Lundh <[EMAIL PRO

Re: Case-insensitive string compare?

2008-09-05 Thread Maric Michaud
Le Friday 05 September 2008 14:33:22 J. Clifford Dyer, vous avez écrit : > On Thu, 2008-09-04 at 18:48 -0500, Robert Dailey wrote: > > Thanks everyone for your help. I'm not opposed to using [key.lower() > > for key in stage_map] at all, I was just curious to see if there were > > any cleaner alter

Re: Case-insensitive string compare?

2008-09-05 Thread J. Cliff Dyer
Please keep the discussion on-list. On Fri, 2008-09-05 at 15:36 +0200, Maric Michaud wrote: > Le Friday 05 September 2008 14:33:22 J. Clifford Dyer, vous avez écrit : > > On Thu, 2008-09-04 at 18:48 -0500, Robert Dailey wrote: > > > Thanks everyone for your help. I'm not opposed to using [key.lowe

Re: cx_oracle and commands

2008-09-05 Thread Edwin . Madari
gaius hammond Wrote: >Hi all, > > >I am having a very strange problem with cx_Oracle, has anyone >seen this kind of behavior before: > > > >ActivePython 2.5.2.2 (ActiveState Software Inc.) based on >Python 2.5.2 (r252:60911, Mar 27 2008, 18:53:24) [C] on sunos5 >Type "help", "copyright", "credits"

Re: Core dumped while interacting with OpenOffice.org via pyuno

2008-09-05 Thread Maric Michaud
Le Friday 05 September 2008 15:04:22 Marco Bizzarri, vous avez écrit : > Hi all. > > I'm experiencing a core dump while working in the following environment > > - debain etch > - python2.3 > - openoffice.org 2.4 > - Zope 2.8.8 > > I was able to get a core dump, and the backtrace shows the following

  1   2   >