Re: __init__ in subclass of tuple

2007-03-09 Thread Gabriel Genellina
En Sat, 10 Mar 2007 02:36:41 -0300, Alan Isaac <[EMAIL PROTECTED]> escribió: > I am probably confused about immutable types. > But for now my questions boil down to these two: > > - what does ``tuple.__init__`` do? Nothing. tuple.__init__ does not even exist, as tuples are immutable, they are

__init__ in subclass of tuple

2007-03-09 Thread Alan Isaac
I am probably confused about immutable types. But for now my questions boil down to these two: - what does ``tuple.__init__`` do? - what is the signature of ``tuple.__init__``? These questions are stimulated by http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/303439 Looking at that, what f

Re: bisect on a list of lists

2007-03-09 Thread Gabriel Genellina
En Sat, 10 Mar 2007 01:23:11 -0300, Paulo da Silva <[EMAIL PROTECTED]> escribió: > Gabriel Genellina escreveu: > >> Just omit the __init__ method, if you don't have anything additional to >> do. The inherited method will be used instead, as always: > > > Then, if I have something additional, I c

Re: C++ and Python

2007-03-09 Thread Gabriel Genellina
En Fri, 09 Mar 2007 18:16:43 -0300, hg <[EMAIL PROTECTED]> escribió: > I'm not very familiar with the technology as I just have had to modify an > extension here and there. > > I guess my question is off topic as a C++ dll / shared lib is not my main > target but rather C: I need to integrate a pr

Re: bisect on a list of lists

2007-03-09 Thread Paulo da Silva
Gabriel Genellina escreveu: ... > Just omit the __init__ method, if you don't have anything additional to > do. The inherited method will be used instead, as always: Then, if I have something additional, I can do def __init__(self,l=None): if l!=None:

Re: C++ and Python

2007-03-09 Thread hg
Gabriel Genellina wrote: > En Fri, 09 Mar 2007 05:28:54 -0300, hg <[EMAIL PROTECTED]> escribió: > >> Mandus wrote: >>> 8 Mar 2007 22:04:48 -0800 skrev [EMAIL PROTECTED]: I'm considering about generating some Python Bindings for C++ libraries. What are considered the best tools for doing

*** The most profound and the most fragrant words ***

2007-03-09 Thread stj911
The most profound and some of the most morally fragrant words by the True jewish rabbis of the neturei karta ... please visit www.nkusa.org for more information When the fear of the Almighty is Absent All Becomes Permitted including adulteries, 911 controlled demolitions and mass murders . ...

Re: Unexpected behavior of list of list

2007-03-09 Thread Gabriel Genellina
En Fri, 09 Mar 2007 23:58:59 -0300, Steven D'Aprano <[EMAIL PROTECTED]> escribió: > You know, now that Python has a warnings module, it would be really good > if list-of-lists*int raised a warning. Does anyone know if that's > feasible > or possible? It needn't catch every imaginable Gotcha, j

Re: bisect on a list of lists

2007-03-09 Thread Gabriel Genellina
En Fri, 09 Mar 2007 23:45:50 -0300, Steven D'Aprano <[EMAIL PROTECTED]> escribió: > On Fri, 09 Mar 2007 18:57:42 -0300, Gabriel Genellina wrote: > >> En Fri, 09 Mar 2007 17:15:44 -0300, Paulo da Silva >> <[EMAIL PROTECTED]> escribió: >> >>> What is the best way to have something like the bisect_

Re: Unexpected behavior of list of list

2007-03-09 Thread Steven D'Aprano
On Fri, 09 Mar 2007 17:30:09 -0800, kghose wrote: > Hi, > > The following code > > listoflists = [[]]*2 > listoflists[0].append(1) > > appends(1) to both listoflists[0] and listoflists[1] (which I did not > expect) I think you will find the same question raised barely a few hours ago. Hint: >

Re: nokia s60 python code debugging with komodo

2007-03-09 Thread Trent Mick
[EMAIL PROTECTED] wrote: > anyway I can setup and debug nokia s60 python in komodo ( a python IDE > )? Apoloies for the crazy-late reply. We tried to get Python debugging working on Nokia phones a while back but couldn't get far because the socket implementation of the Nokia Python port wasn't u

Re: bisect on a list of lists

2007-03-09 Thread Steven D'Aprano
On Fri, 09 Mar 2007 18:57:42 -0300, Gabriel Genellina wrote: > En Fri, 09 Mar 2007 17:15:44 -0300, Paulo da Silva > <[EMAIL PROTECTED]> escribió: > >> What is the best way to have something like the bisect_left >> method on a list of lists being the comparision based on an >> specified arbitrar

Re: Python-list Digest, Vol 42, Issue 117

2007-03-09 Thread skip
Bart> I'm sorry, but what's wrong with: Bart> radix = [ [] ] * 256 Follow it up with: print [id(e) for e in radix] then you tell me what's wrong with it. ;-) Skip -- http://mail.python.org/mailman/listinfo/python-list

Re: Unexpected behavior of list of list

2007-03-09 Thread Gabriel Genellina
En Fri, 09 Mar 2007 22:30:09 -0300, kghose <[EMAIL PROTECTED]> escribió: > The following code > > listoflists = [[]]*2 > listoflists[0].append(1) > > appends(1) to both listoflists[0] and listoflists[1] (which I did not > expect) See latest posts on this list, or read the FAQ. -- Gabriel Gene

Re: bisect on a list of lists

2007-03-09 Thread Gabriel Genellina
En Fri, 09 Mar 2007 21:25:24 -0300, Paulo da Silva <[EMAIL PROTECTED]> escribió: > Thanks Gabriel. This sounds very nice for my purpose. > I have some doubts however. How do I "transform" a list into > MyList? Is this the best way? > > class MyList(list): > def __init__(self,l=None): >

Re: Python-list Digest, Vol 42, Issue 117

2007-03-09 Thread Gabriel Genellina
En Fri, 09 Mar 2007 18:35:59 -0300, Bart Willems <[EMAIL PROTECTED]> escribió: > I'm sorry, but what's wrong with: > radix = [ [] ] * 256 http://www.python.org/doc/faq/programming.html#how-do-i-create-a-multidimensional-list http://www.python.org/doc/faq/general.html#why-are-default-values-shar

Re: Are Lists thread safe?

2007-03-09 Thread Gabriel Genellina
En Fri, 09 Mar 2007 16:50:04 -0300, abcd <[EMAIL PROTECTED]> escribió: > I guess this might be overkill then... That depends on your target. For the *current* CPython implementation, yes, because it has an internal lock. But other versions (like Jython or IronPython) may not behave that way.

Re: Unexpected behavior of list of list

2007-03-09 Thread kghose
On Mar 9, 8:30 pm, "kghose" <[EMAIL PROTECTED]> wrote: > Hi, > > The following code > > listoflists = [[]]*2 > listoflists[0].append(1) > > appends(1) to both listoflists[0] and listoflists[1] (which I did not > expect) > > while > > listoflists = [[]]*2 > listoflists[0] = [1] > listoflists[0].appe

whois python interface

2007-03-09 Thread [EMAIL PROTECTED]
Is there a python whois interface? I googled and tried rwhois.py but it doesnt work at all. thanks mark >>> a=rwhois.DomainRecord('google.com') >>> a.chooseserver() Traceback (most recent call last): File "", line 1, in ? File "rwhois.py", line 270, in chooseserver tmp=self._whois() File

Unexpected behavior of list of list

2007-03-09 Thread kghose
Hi, The following code listoflists = [[]]*2 listoflists[0].append(1) appends(1) to both listoflists[0] and listoflists[1] (which I did not expect) while listoflists = [[]]*2 listoflists[0] = [1] listoflists[0].append(2) works as expected.i.e. only listoflists[0] gets 2 appended to it and any

Re: pylint: don't warn about tabs

2007-03-09 Thread Alan Isaac
On Fri, 9 Mar 2007, [EMAIL PROTECTED] apparently wrote: > Finally, note this from PEP 666: > The problem is that there is no polite way to say > 'Stop wasting your valuable time and mine.' > That's as politely as I can put it. I really think you should reread the PEP, which is making th

UTF-8 output problems

2007-03-09 Thread Michael B. Trausch
I am having a slight problem with UTF-8 output with Python. I have the following program: x = 0 while x < 0x4000: print u"This is Unicode code point %d (0x%x): %s" % (x, x, unichr(x)) x += 1 This program works perfectly when run directly: [EMAIL PROTECTED]:~/tmp$ python test.py This is

Re: Need help with a string plz! (newbie)

2007-03-09 Thread israphelr
On 9 Mar, 21:58, Larry Bates <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > On Mar 9, 9:37 pm, Grant Edwards <[EMAIL PROTECTED]> wrote: > >> On 2007-03-09, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > >>> I thought maybe I could create another variable and then assign each > >>> char

Re: Python-list Digest, Vol 42, Issue 117

2007-03-09 Thread Bart Willems
I'm sorry, but what's wrong with: radix = [ [] ] * 256 Cheers, Bart "John" writes: >> For my code of radix sort, I need to initialize 256 buckets. My code looks a >> little clumsy: >> >> radix=[[]] >> for i in range(255): >> radix.append([]) >> >> any better code to initalize this list? >>

Re: {Possible_Spam} Re: {Possible_Spam} tkinter text editor

2007-03-09 Thread John McMonagle
-- Original Message --- From: Gigs <[EMAIL PROTECTED]> To: John McMonagle <[EMAIL PROTECTED]> Sent: Sat, 10 Mar 2007 15:13:20 +0100 Subject: {Possible_Spam} Re: {Possible_Spam} tkinter text editor > John McMonagle wrote: > > Gigs_ wrote: > >> I'm writing text editor. > >> > >> How

Re: bisect on a list of lists

2007-03-09 Thread Paulo da Silva
Gabriel Genellina escreveu: > En Fri, 09 Mar 2007 17:15:44 -0300, Paulo da Silva > <[EMAIL PROTECTED]> escribió: ... > > lists *are* classes (at least since Python 2.2) > Inherit from the builtin list, redefine __cmp__(self, other) as ... Thanks Gabriel. This sounds very nice for my purpose. I h

Google Summer of Code 2007

2007-03-09 Thread jtauber
Google's Summer of Code is on again! And the Python Software Foundation is again applying to be a mentoring organization. A mailing list has been set up for people who are interested in mentoring for the PSF. If you aren't able or willing to mentor but still want to participate in discussion of p

Re: Reading a portion of a file

2007-03-09 Thread Gabriel Genellina
En Fri, 09 Mar 2007 11:28:15 -0300, Vulcanius <[EMAIL PROTECTED]> escribió: > Here is the code I've come up with. Please feel free to critique it > and let me know what you would change. Also, as you can see I call > "open(SERVER,'r')" twice; but I want to only call it once, what would > the bes

Re: Is this right? Multiple imports of same module.

2007-03-09 Thread Ben Finney
Lou Pecora <[EMAIL PROTECTED]> writes: > ['import mymodule' in three separate modules] > > Then mymodule is imported only once, but each module has access to > it through the module name (mod1 and mod2) and the alias MM (mod3). > Is that right? Not quite. The module is imported three times, and i

File IO errors with PyPDF

2007-03-09 Thread John Henry
Hi list, I am having trouble with PyPDF (tried earlier as well as latest version 1.9). I am using it to combine a number of single page PDF files into one. It works perfectly for up to 8 files but after that, I get a "too many files opened" message. My code goes somewhat like: PdfOutput = Pdf

Re: pylint: don't warn about tabs

2007-03-09 Thread skip
Alan> "Ben Finney" <[EMAIL PROTECTED]> wrote in message Alan> news:[EMAIL PROTECTED] >> Sticking to spaces for indentation avoids the ambiguity of >> interpretation that ASCII TAB characters are subject to. Alan> What ambiguity? Alan> Tabs are *less* ambiguous. Alan> O

Re: 2 new comment-like characters in Python to aid development?

2007-03-09 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > But # is 'only a comment sign' as well, and equally meaningless to > the interpreter. No! "#" means "disregard everything until EOL" to the interpreter. Your proposed highlighting character means exactly nothing to the interpreter. Get the difference? > But it's still

Re: pylint: don't warn about tabs

2007-03-09 Thread Alan Isaac
> Alan Isaac wrote: > > I am brand new to pylint. > > As a tab user, I want the tabs warning turned off. "Robert Kern" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > doc/features.txt > examples/pylintrc The example is very helpful. Thanks! Alan -- http://mail.python.org/mailman/

Re: pylint: don't warn about tabs

2007-03-09 Thread Alan Isaac
"Ben Finney" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Sticking to spaces for indentation avoids the ambiguity of > interpretation that ASCII TAB characters are subject to. What ambiguity? Tabs are *less* ambiguous. One tab character is one level of indentation. I have never se

Re: This web site creates a *popup window* => how fetch contents in a script?

2007-03-09 Thread [EMAIL PROTECTED]
On Mar 6, 12:27 pm, Paul Rubin wrote: > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > > Sure I can grab the aforementioned URL's contents but what about the > > NEW contents in the NEW popup window that appears AFTER you press some > > form buttons? How grab *that* ?

Re: How to Start a (thread?) and Leave

2007-03-09 Thread [EMAIL PROTECTED]
On Mar 9, 4:57 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > | On Mar 9, 3:25 pm, "abcd" <[EMAIL PROTECTED]> wrote: > Can you tell the page to auto-refresh itself every 15 seconds or so? I > have seen this as a user but don't know

Re: How to Start a (thread?) and Leave

2007-03-09 Thread [EMAIL PROTECTED]
On Mar 9, 4:57 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > Can you tell the page to auto-refresh itself every 15 seconds or so? I > have seen this as a user but don't know if it is special html code or > javascript or java or wh

Re: floating point rounding

2007-03-09 Thread hg
John Henry wrote: > On Mar 9, 5:45 am, hg <[EMAIL PROTECTED]> wrote: >> hg wrote: >> > Hi, >> >> > Here is my issue: >> >> > f = 1.5 * 0.01 >> > f >> >>> 0.014999 >> > '%f' % f >> >>>'0.015000' >> >> > But I really want to get 0.02 as a result ... is there a way out ? >> >> > Thanks, >

Re: bisect on a list of lists

2007-03-09 Thread Peter Otten
Paulo da Silva wrote: > What is the best way to have something like the bisect_left > method on a list of lists being the comparision based on an > specified arbitrary i_th element of each list element? A simple way that leaves the lists untouched: >>> import bisect, random >>> from operator imp

Adding Lib/site-packages

2007-03-09 Thread Ashwin Kashyap
Hello, I am trying to create a python distribution using the Python-2.5 sources. What I would like to do is to add a bunch of Python packages to the Lib/site-packages directory and have them compiled and installed when I do a ./configure && make install For example, I checked in M2Crypto, python-c

Re: is this a bug? (python 2.3)

2007-03-09 Thread Gabriel Genellina
En Fri, 09 Mar 2007 17:43:53 -0300, Carsten Haese <[EMAIL PROTECTED]> escribió: >> class warfare: >> def __init__(self): self.pairs = [[0,0]]*2 >> def __str__(self): return str(self.pairs) >> def setfirst (self,i,value): self.pairs[i][0] = value >> def setsecond(self,i,value): se

Re: bisect on a list of lists

2007-03-09 Thread bearophileHUGS
Paulo da Silva: > What is the best way to have something like the bisect_left > method on a list of lists being the comparision based on an > specified arbitrary i_th element of each list element? You may use this recipe of mine that I've just put there for you, but it's not fully tested yet (if y

Re: Need help with a string plz! (newbie)

2007-03-09 Thread Larry Bates
[EMAIL PROTECTED] wrote: > On Mar 9, 9:37 pm, Grant Edwards <[EMAIL PROTECTED]> wrote: >> On 2007-03-09, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> >>> I thought maybe I could create another variable and then assign each >>> character into the new string by concatenating, makign a new string >

Re: floating point rounding

2007-03-09 Thread John Henry
On Mar 9, 5:45 am, hg <[EMAIL PROTECTED]> wrote: > hg wrote: > > Hi, > > > Here is my issue: > > > f = 1.5 * 0.01 > > f > >>> 0.014999 > > '%f' % f > >>>'0.015000' > > > But I really want to get 0.02 as a result ... is there a way out ? > > > Thanks, > > > hg > > round Or more precise

Re: Creating a DLL file from Python Code

2007-03-09 Thread ici
On Mar 9, 2:08 pm, [EMAIL PROTECTED] wrote: > Hi, > > I would like to request your attention for this very specific issue: > > I have several classes in Python, and now I want simply re-use it, in > other language. > > The closest to solution I think I came was with this > site:http://www.py2exe.o

Re: bisect on a list of lists

2007-03-09 Thread Gabriel Genellina
En Fri, 09 Mar 2007 17:15:44 -0300, Paulo da Silva <[EMAIL PROTECTED]> escribió: > What is the best way to have something like the bisect_left > method on a list of lists being the comparision based on an > specified arbitrary i_th element of each list element? > > Is there, for lists, something

Re: How to Start a (thread?) and Leave

2007-03-09 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | On Mar 9, 3:25 pm, "abcd" <[EMAIL PROTECTED]> wrote: | > probably a Thread. | | | But a thread leaves the script running until the thread exits, right? | So the webpage would just keep saying "loading" at the bottom I think. Can you t

Re: Need help with a string plz! (newbie)

2007-03-09 Thread israphelr
On Mar 9, 9:37 pm, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2007-03-09, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > I thought maybe I could create another variable and then assign each > > character into the new string by concatenating, makign a new string > > each time, but I find this

Re: Need help with a string plz! (newbie)

2007-03-09 Thread Grant Edwards
On 2007-03-09, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > On Mar 9, 9:29 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: >> In <[EMAIL PROTECTED]>, israphelr >> wrote: > >> In [57]: 'reversed string'[::-1] >> Out[57]: 'gnirts desrever' > > > Sorry, I didn't understand this. First read

Re: Need help with a string plz! (newbie)

2007-03-09 Thread Grant Edwards
On 2007-03-09, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > # > print "\nWelcome !" > print "\nEnter a word, and the world will be reversed!" > > word = raw_input("\nPlease Enter a word: ") > > end = len(word) > end -= 1 > > for position in range(end, -1, -1): >

Re: Need help with a string plz! (newbie)

2007-03-09 Thread israphelr
On Mar 9, 9:29 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > In <[EMAIL PROTECTED]>, israphelr > wrote: > In [57]: 'reversed string'[::-1] > Out[57]: 'gnirts desrever' Sorry, I didn't understand this. -- http://mail.python.org/mailman/listinfo/python-list

Re: Need help with a string plz! (newbie)

2007-03-09 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, israphelr wrote: > So I created a program, that gets a string from a user and then prints > the string in reverse order. In [57]: 'reversed string'[::-1] Out[57]: 'gnirts desrever' Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-l

Need help with a string plz! (newbie)

2007-03-09 Thread israphelr
Hi all So I created a program, that gets a string from a user and then prints the string in reverse order. Now, here's the code; # print "\nWelcome !" print "\nEnter a word, and the world will be reversed!" word = raw_input("\nPlease Enter a word: ") end = len(w

Re: 2 new comment-like characters in Python to aid development?

2007-03-09 Thread Robert Marshall
On 09 Mar 2007, Matthew Woodcraft wrote: > Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Nick Craig-Wood a ecrit : >> I use # FIXME for this purpose or /* FIXME */ in C etc. >> >> I have an emacs macro which shows it up in bright red / yellow >> text so it is easy to see >

Re: C++ and Python

2007-03-09 Thread Gabriel Genellina
En Fri, 09 Mar 2007 05:28:54 -0300, hg <[EMAIL PROTECTED]> escribió: > Mandus wrote: >> 8 Mar 2007 22:04:48 -0800 skrev [EMAIL PROTECTED]: >>> I'm considering about generating some Python Bindings for C++ >>> libraries. What are considered the best tools for doing something like >>> this? I know t

Re: is this a bug? (python 2.3)

2007-03-09 Thread Sean McIlroy
thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: How to Start a (thread?) and Leave

2007-03-09 Thread [EMAIL PROTECTED]
On Mar 9, 3:45 pm, "abcd" <[EMAIL PROTECTED]> wrote: > > But a thread leaves the script running until the thread exits, right? > > So the webpage would just keep saying "loading" at the bottom I think. > > > -Greg > > give it a shot. if you spawn off a new thread your code should keep > executing

Re: How to Start a (thread?) and Leave

2007-03-09 Thread abcd
> But a thread leaves the script running until the thread exits, right? > So the webpage would just keep saying "loading" at the bottom I think. > > -Greg give it a shot. if you spawn off a new thread your code should keep executing while the thread does its work in the "background". -- http://

Re: floating point rounding

2007-03-09 Thread hg
hg wrote: > Hi, > > Here is my issue: > > f = 1.5 * 0.01 > f >>> 0.014999 > '%f' % f >>>'0.015000' > > > But I really want to get 0.02 as a result ... is there a way out ? > > Thanks, > > hg round -- http://mail.python.org/mailman/listinfo/python-list

Re: is this a bug? (python 2.3)

2007-03-09 Thread Carsten Haese
On Fri, 2007-03-09 at 12:32 -0800, Sean McIlroy wrote: > hi all > > when i run this code in python 2.3 > > ## BEGIN CODE > class warfare: > def __init__(self): self.pairs = [[0,0]]*2 > def __str__(self): return str(self.pairs) > def setfirst (self,i,value): self.p

is this a bug? (python 2.3)

2007-03-09 Thread Sean McIlroy
hi all when i run this code in python 2.3 ## BEGIN CODE class warfare: def __init__(self): self.pairs = [[0,0]]*2 def __str__(self): return str(self.pairs) def setfirst (self,i,value): self.pairs[i][0] = value def setsecond(self,i,value): self.pairs[i][1] = va

Re: How to Start a (thread?) and Leave

2007-03-09 Thread [EMAIL PROTECTED]
On Mar 9, 3:25 pm, "abcd" <[EMAIL PROTECTED]> wrote: > probably a Thread. But a thread leaves the script running until the thread exits, right? So the webpage would just keep saying "loading" at the bottom I think. -Greg -- http://mail.python.org/mailman/listinfo/python-list

Re: merits of Lisp vs Python

2007-03-09 Thread Gabriel Genellina
En Fri, 09 Mar 2007 16:10:51 -0300, Tim Bradshaw <[EMAIL PROTECTED]> escribió: > On 2007-03-09 07:00:06 +, [EMAIL PROTECTED] (Alex Martelli) said: >> (nee "One Laptop Per Child", OLPC, and once known as the "$100 laptop") >> uses Python as its preferred (only?-) application language, and it's

Re: How to Start a (thread?) and Leave

2007-03-09 Thread abcd
probably a Thread. -- http://mail.python.org/mailman/listinfo/python-list

bisect on a list of lists

2007-03-09 Thread Paulo da Silva
Hi! What is the best way to have something like the bisect_left method on a list of lists being the comparision based on an specified arbitrary i_th element of each list element? Is there, for lists, something equivalent to the __cmp__ function for classes? Thanks. -- http://mail.python.org/mai

Re: Are Lists thread safe?

2007-03-09 Thread abcd
On Mar 9, 2:50 pm, "abcd" <[EMAIL PROTECTED]> wrote: > I guess this might be overkill then... > > class MyList(list): > def __init__(self): > self.l = threading.Lock() > > def append(self, val): > try: > self.l.acquire() > list.append(self, val) >

How to Start a (thread?) and Leave

2007-03-09 Thread [EMAIL PROTECTED]
Here's my situation, would you folks be so kind as to reccomend an approach? I have a small Python CGI script running as an intranet app. One of the things the script needs to do is allow users to save invoices. This is a process that takes about 60 seconds once the user submits the order from th

Re: merits of Lisp vs Python

2007-03-09 Thread Michael Bentley
On Mar 9, 2007, at 1:10 PM, Tim Bradshaw wrote: > On 2007-03-09 07:00:06 +, [EMAIL PROTECTED] (Alex Martelli) said: > >> (nee "One Laptop Per Child", OLPC, and once known as the "$100 >> laptop") >> uses Python as its preferred (only?-) application language, and it's >> slated to be the most

Re: Are Lists thread safe?

2007-03-09 Thread abcd
I guess this might be overkill then... class MyList(list): def __init__(self): self.l = threading.Lock() def append(self, val): try: self.l.acquire() list.append(self, val) finally: if self.l.locked(): self.l.rele

Re: Are Lists thread safe?

2007-03-09 Thread abcd
Thanks for the link. I saw that one in my google search but didn't visit it for some reason. Looks like most operations should be just fine. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

floating point rounding

2007-03-09 Thread hg
Hi, Here is my issue: f = 1.5 * 0.01 f >> 0.014999 '%f' % f >>'0.015000' But I really want to get 0.02 as a result ... is there a way out ? Thanks, hg -- http://mail.python.org/mailman/listinfo/python-list

Re: Are Lists thread safe?

2007-03-09 Thread Greg Copeland
On Mar 9, 1:03 pm, "abcd" <[EMAIL PROTECTED]> wrote: > Are lists thread safe? Or do I have to use a Lock when modifying the > list (adding, removing, etc)? Can you point me to some documentation > on this? > > thanks Yes there are still some holes which can bite you. Adding and removing is thr

Re: Best place for a function?

2007-03-09 Thread Inyeol Lee
On Wed, Mar 07, 2007 at 05:27:04PM -0500, Sergio Correia wrote: > I'm writing a class, where one of the methods is kinda complex. The > method uses a function which I know for certain will not be used > anywhere else. This function does not require anything from self, only > the args passed by the

Re: Are Lists thread safe?

2007-03-09 Thread Larry Bates
abcd wrote: > Are lists thread safe? Or do I have to use a Lock when modifying the > list (adding, removing, etc)? Can you point me to some documentation > on this? > > thanks > You really should at least try Google first: http://effbot.org/pyfaq/what-kinds-of-global-value-mutation-are-thread-

Re: merits of Lisp vs Python

2007-03-09 Thread Tim Bradshaw
On 2007-03-09 07:00:06 +, [EMAIL PROTECTED] (Alex Martelli) said: > (nee "One Laptop Per Child", OLPC, and once known as the "$100 laptop") > uses Python as its preferred (only?-) application language, and it's > slated to be the most widely distributed Python distro if it hits even > half of

Re: 2 new comment-like characters in Python to aid development?

2007-03-09 Thread Matthew Woodcraft
Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: Nick Craig-Wood a ecrit : > I use # FIXME for this purpose or /* FIXME */ in C etc. > > I have an emacs macro which shows it up in bright red / yellow text > so it is easy to see > Thanks you both. For what it's worth, sufficien

Are Lists thread safe?

2007-03-09 Thread abcd
Are lists thread safe? Or do I have to use a Lock when modifying the list (adding, removing, etc)? Can you point me to some documentation on this? thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: SQLite3 trapping OperationalError

2007-03-09 Thread jim-on-linux
On Friday 09 March 2007 13:10, Jerry Hill wrote: > On 3/9/07, jim-on-linux <[EMAIL PROTECTED]> wrote: > > However python 2.5, > > except OperationalError: > > responds with > > "OperationalError" is not defined. > > I believe that needs to be spelled > except sqlite3.OperationalError: > do_som

Re: SQLite3 trapping OperationalError

2007-03-09 Thread Jerry Hill
On 3/9/07, jim-on-linux <[EMAIL PROTECTED]> wrote: > However python 2.5, > except OperationalError: > responds with > "OperationalError" is not defined. I believe that needs to be spelled except sqlite3.OperationalError: do_something() -- Jerry -- http://mail.python.org/mailman/listinfo/pyt

SQLite3 trapping OperationalError

2007-03-09 Thread jim-on-linux
pyhelp, I set up a table in SQLite3. While running other modules I want to know if a table exists. SQL has a command "List Tables" but I don't think SQLlite3 has this command. I've tried cursor.execute("select * from debtor where key is not null ") The table debtor does not exist so

Re: about application deployment

2007-03-09 Thread Larry Bates
Alessandro de Manzano wrote: > Hello, > > I'ld ask you all about deployment of python applications. > > Sometimes (if not most times..) I would make deployment easy (easier) > for my customers (and for me too...) > > What I mean, would be very useful to have a "jar-like" archive/single > file /

Re: 2 new comment-like characters in Python to aid development?

2007-03-09 Thread Diez B. Roggisch
>> The ? has no meaning. It only has a meaning for an editor. > > So it _does_ have meaning! I'm sorry I just don't buy into this kind > of abstract programming ideology, and I never really have. I don't > care what the interpreter finds meaningful and neither, on a day to > day basis, do most us

Re: Pb with descriptor and super ...

2007-03-09 Thread Arnaud Delobelle
On Mar 9, 11:22 am, Erwan Adam <[EMAIL PROTECTED]> wrote: [snip] > > [EMAIL PROTECTED] /home/adam/Work/Python]> python super_from_guido.py > Using built-in super > Desc.__get__ : class_name is A, obj is <__main__.B object at 0xb7bc302c> > and typ is > Using python Super > Desc.__get__ : class_name

Re: Creat a DLL File from python code, and use that DLL file in other Platform (Labview, Java .NET etc)

2007-03-09 Thread Larry Bates
[EMAIL PROTECTED] wrote: > Hi, > > I would like to request your attention for this very specific issue: > > I have several classes in Python, and now I want simply re-use it, in > other language. > > > The closest to solution I think I came was with this site: > http://www.py2exe.org/index.cgi/

Re: 2 new comment-like characters in Python to aid development?

2007-03-09 Thread dbhbarton
> But all of them are clear on how they work: they affect one line, or have a > bracket style like /* */ and thus demark clearly what they affect. Even > someone not fluent in the language in question will quickly grab what they > mean. There's nothing remotely fuzzy about how wip or halt comments

Re: Is this right? Multiple imports of same module.

2007-03-09 Thread Michele Simionato
On Mar 9, 5:18 pm, Lou Pecora <[EMAIL PROTECTED]> wrote: > I have noticed that using from xxx import * can lead to problems when > trying to access variables in the xxx module. ``from xxx import *`` is intended to be used in the interactive interpreter only. Michele Simionato -- http://

Problem with new Vista and os.system

2007-03-09 Thread Arne Jamtgaard
I'm getting myself set up on a new Vista box at work, and one of my old scripts has stopped working. Specifically, all calls to os.system return a -1. Whatever action I was asking os.system to run does not take place. Is this a Vista thing, or perhaps just a wonky setting in my environment? I've

Problem with new Vista and os.system

2007-03-09 Thread Arne Jamtgaard
I'm getting myself set up on a new Vista box at work, and one of my old scripts has stopped working. Specifically, all calls to os.system return a -1. Whatever action I was asking os.system to run does not take place. Is this a Vista thing, or perhaps just a wonky setting in my environment. Oh,

Re: about application deployment

2007-03-09 Thread Jeff McNeil
If a .egg file is in your sys.path, it would be nice to simply use 'python -m' in my opinion. As far as I know, you can't '-m' a module that's been imported from a zip file? On 3/9/07, Diez B. Roggisch <[EMAIL PROTECTED]> wrote: Alessandro de Manzano wrote: > Hello, > > I'ld ask you all abou

Re: number generator

2007-03-09 Thread Steven D'Aprano
On Fri, 09 Mar 2007 06:44:01 -0800, cesco wrote: > I have to generate a list of N random numbers (integer) whose sum is > equal to M. If, for example, I have to generate 5 random numbers whose > sum is 50 a possible solution could be [3, 11, 7, 22, 7]. Is there a > simple pattern or function in Py

Re: opinion needed

2007-03-09 Thread Grant Edwards
On 2007-03-09, Diez B. Roggisch <[EMAIL PROTECTED]> wrote: > azrael wrote: > >> id like to hear your opinion about something. >> I just started using Prolog yesterday and i have my doubts about it, >> but it seems to me something like object oriented. so i wanted to ask >> you how usefull prolog is

Re: Is this right? Multiple imports of same module.

2007-03-09 Thread Lou Pecora
In article <[EMAIL PROTECTED]>, "Bart Ogryczak" <[EMAIL PROTECTED]> wrote: > On Mar 9, 3:30 pm, Lou Pecora <[EMAIL PROTECTED]> wrote: > > Then mymodule is imported only once, but each module has access to it > > through the module name (mod1 and mod2) and the alias MM (mod3). Is > > that right?

Re: Is this right? Multiple imports of same module.

2007-03-09 Thread Simon Brunning
On 3/9/07, Lou Pecora <[EMAIL PROTECTED]> wrote: > I have noticed that using from xxx import * can lead to problems when > trying to access variables in the xxx module. Don't do it, then. ;-) -- Cheers, Simon B [EMAIL PROTECTED] http://www.brunningonline.net/simon/blog/ -- http://mail.python.or

Re: Is this right? Multiple imports of same module.

2007-03-09 Thread Lou Pecora
In article <[EMAIL PROTECTED]>, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > In <[EMAIL PROTECTED]>, Lou Pecora wrote: > > > *In mod1.py > > > > import mymodule > > > > *In mod2.py > > > > import mymodule > > > > *In mod3.py > > > > import mymodule as MM > > > > Then mymodule is i

Re: number generator

2007-03-09 Thread Bjoern Schliessmann
cesco wrote: > On Mar 9, 3:51 pm, Paul Rubin >> "cesco" <[EMAIL PROTECTED]> writes: >>> I have to generate a list of N random numbers (integer) whose >>> sum is equal to M. If, for example, I have to generate 5 random >>> numbers whose sum is 50 a possible solution could

Re: about application deployment

2007-03-09 Thread Diez B. Roggisch
Alessandro de Manzano wrote: > Hello, > > I'ld ask you all about deployment of python applications. > > Sometimes (if not most times..) I would make deployment easy (easier) > for my customers (and for me too...) > > What I mean, would be very useful to have a "jar-like" archive/single > file /

Re: opinion needed

2007-03-09 Thread Diez B. Roggisch
azrael wrote: > id like to hear your opinion about something. > I just started using Prolog yesterday and i have my doubts about it, > but it seems to me something like object oriented. so i wanted to ask > you how usefull prolog is. Sure this is no prolog newsgroup so my > question is: because it

about application deployment

2007-03-09 Thread Alessandro de Manzano
Hello, I'ld ask you all about deployment of python applications. Sometimes (if not most times..) I would make deployment easy (easier) for my customers (and for me too...) What I mean, would be very useful to have a "jar-like" archive/single file / multiple platform in order to deploy also compl

Re: opinion needed

2007-03-09 Thread Bart Ogryczak
On Mar 9, 4:27 pm, "azrael" <[EMAIL PROTECTED]> wrote: > id like to hear your opinion about something. > I just started using Prolog yesterday and i have my doubts about it, > but it seems to me something like object oriented. so i wanted to ask > you how usefull prolog is. It's very useful for "L

Re: 2 new comment-like characters in Python to aid development?

2007-03-09 Thread Bruno Desthuilliers
Nick Craig-Wood a écrit : > Robert Marshall <[EMAIL PROTECTED]> wrote: >> On Fri, 09 Mar 2007, Bruno Desthuilliers wrote: >> >>> Nick Craig-Wood a ?crit : [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > What if 2 new 'special' comment-like characters were added to > Python?: > >>

  1   2   >