Re: Why is this blowing the stack, thought it was tail-recursive...

2008-07-13 Thread Steven D'Aprano
On Sat, 12 Jul 2008 19:25:18 -0400, Terry Reedy wrote: > ssecorp wrote: >> def fib(n): >> def fibt(a, b, n): >> if n <= 1: >> return b >> else: >> return fibt(b, a + b, n - 1) >> if n == 0: >> return 0 >> else: >> return fibt(0, 1

Re: iterator clone

2008-07-13 Thread Peter Otten
Yosifov Pavel wrote: > Whats is the way to clone "independent" iterator? I can't use tee(), > because I don't know how many "independent" iterators I need. copy and > deepcopy doesn't work... There is no general way. For "short" sequences you can store the items in a list which is also the worst-

Re: spam <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>

2008-07-13 Thread Kevin McMurtrie
In article <[EMAIL PROTECTED]>, Lew <[EMAIL PROTECTED]> wrote: > WDC wrote: > > BTW I reported it, yo should too. > > To whom did you report it, so that we may also report it there? Google does not accept spam complaints. Go ahead, try it. That's why they've been the #1 Usenet spamming tool

Re: Beginner Question : Iterators and zip

2008-07-13 Thread moogyd
On 12 Jul, 21:50, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On 12 juil, 20:55, [EMAIL PROTECTED] wrote: > > > > zip is (mostly) ok. What you're missing is how to use it for any > arbitrary number of sequences. Try this instead: > > >>> lists = [range(5), range(5,11), range(11, 16)] > >>> lis

Re: socket.connect() hangs in SYN_SENT state.

2008-07-13 Thread Miles
On Sat, Jul 12, 2008 at 11:23 PM, bukzor <[EMAIL PROTECTED]> wrote: > I'm connecting to an apache2 process on the same machine, > for testing. When looking at netstat, the socket is in the SYN_SENT > state, like this: > > $netstat -a -tcp > tcp0 0 *:www *:* LISTEN

Re: Problems with curses

2008-07-13 Thread Marc 'BlackJack' Rintsch
On Sat, 12 Jul 2008 20:49:56 -0400, Clay Hobbs wrote: > Unfortunately, the error message isn't very helpful. But it would be helpful to tell it. If you get exceptions, always copy'n'paste the traceback here. People might know what the exception means and share their wisdom. Ciao,

matplotlib: is there something like DISLIN's "call newpag" ?

2008-07-13 Thread Ralf . Schaa
Hi there, hope somebody here can help me out: is there a command in matplotlib which resembles DISLIN's "CALL NEWPAG" ? I am trying to make multiple plots on several pages, all stored in one ps (or pdf) document. Cheers -Ralf -- http://mail.python.org/mailman/listinfo/python-list

Re: heapq question

2008-07-13 Thread Duncan Booth
"Giampaolo Rodola'" <[EMAIL PROTECTED]> wrote: > Having said that I'd like to understand if there are cases where > deleting or moving an element of the heap, causes heappop() to return > an element which is not the smallest one. Yes, of course there are: any time you delete element 0 of the heap

Re: iterator clone

2008-07-13 Thread Yosifov Pavel
On 13 июл, 14:12, Peter Otten <[EMAIL PROTECTED]> wrote: > Yosifov Pavel wrote: > > Whats is the way to clone "independent" iterator? I can't use tee(), > > because I don't know how many "independent" iterators I need. copy and > > deepcopy doesn't work... > > There is no general way. For "short" s

Re: iterator clone

2008-07-13 Thread Peter Otten
Yosifov Pavel wrote: > On 13 июл, 14:12, Peter Otten <[EMAIL PROTECTED]> wrote: >> Yosifov Pavel wrote: >> > Whats is the way to clone "independent" iterator? I can't use tee(), >> > because I don't know how many "independent" iterators I need. copy and >> > deepcopy doesn't work... >> >> There is

Re: Correct use of try,except and raise?

2008-07-13 Thread Bart Kastermans
Roy Smith <[EMAIL PROTECTED]> writes: > ssecorp <[EMAIL PROTECTED]> wrote: > >> i dont get what you mean, if i dont do anything python will raise an >> indexerror so it is an indexerror. > > You wrote: > >> > >     def pop(self): >> > >         try: >> > >             return self.queue.pop(0) >> >

Re: Using SWIG to build C++ extension

2008-07-13 Thread mk
Hello Bas, Thanks, man! Your recipe worked on Debian system, though not on RedHat, and I still have no idea why. :-) Anyway, I have it working. Thanks again. I took your example files and did the following: changed the #include "edit_distance.h" to #include "edit_distance.c" in the edit_dist

Re: Changing self: if self is a tree how to set to a different self

2008-07-13 Thread Bart Kastermans
Paul McGuire <[EMAIL PROTECTED]> writes: > On Jul 12, 6:18 am, Bart Kastermans <[EMAIL PROTECTED] > macbook.local> wrote: >> This uses the function: >> >> def NoneOr (tree, mem_function, *arguments): >>     """ if tree is not None then tree.mem_function (arguments). """ >>     if tree == None: >>

Re: Correct use of try,except and raise?

2008-07-13 Thread Ben Finney
Bart Kastermans <[EMAIL PROTECTED]> writes: > Roy Smith <[EMAIL PROTECTED]> writes: > > The defensive thing to do is catch exactly the exception you > > expect to happen. In this case, that means IndexError. > > And you do that by > > except IndexError: >raise TheErrorYouNowWantToRaise You

Re: Why is there no GUI-tools like this for Windows?

2008-07-13 Thread GHZ
There is http://www.codeplex.com/IronPythonStudio -- http://mail.python.org/mailman/listinfo/python-list

Dynamic Invocation Interface

2008-07-13 Thread Ilan
Is there any python CORBA ORB that support Dynamic Invocation Interface? Thanks -- http://mail.python.org/mailman/listinfo/python-list

About wmi

2008-07-13 Thread patrol
I want to prevent some process from running. The code is in the following. I encounter some unexpected troubles. Probelm1: This program cannot terminate "scrcons.exe" and "FNPLicensingService.exe",which are system processes. Problem2:After a while, this program will abort by error File "C:\Pytho

Re: why is "self" used in OO-Python?

2008-07-13 Thread satoru
On Jul 13, 12:32 am, ssecorp <[EMAIL PROTECTED]> wrote: > I first learned about OO from Java. > > I much prefer to program in Python though. > > However I am consufed about 2 things. > > 1. Why do I have to pass self into every method in a class? Since I am > always doing why cant this be automated

Re: Problems with curses

2008-07-13 Thread Clay Hobbs
> On Sat, 12 Jul 2008 20:49:56 -0400, Clay Hobbs wrote: > > > Unfortunately, the error message isn't very helpful. > > But it would be helpful to tell it. If you get exceptions, always > copy'n'paste the traceback here. People might know what the exception > means and share their wisdom. H

spam

2008-07-13 Thread rickman
On Jul 12, 9:21 am, Scott in SoCal <[EMAIL PROTECTED]> wrote: > In message > <[EMAIL PROTECTED]>, > > rickman <[EMAIL PROTECTED]> wrote: > >spam > > *PLONK!* I love the way that people who plonk others feel the need to inform everyone of it. That ranks up there with, "I know what you are, but wha

Functional/Best?

2008-07-13 Thread Tim Cook
I guess I can classify my application(s) as more procedural than anything else. But I have a question about the best way to handle something in Python. When given a mapping of keywords, I want to call a function based on a certain keyword found when parsing a text file. The mapping looks like th

Re: Correct use of try,except and raise?

2008-07-13 Thread Roy Smith
Ben Finney <[EMAIL PROTECTED]> wrote: > If you are passing a sequence conceptually, then it's more Pythonic to > pass it as a sequence explicitly:: > > def __init__(self, items): > """ Call with e.g. Stack(["foo", "bar"]) """ > self.stack = list(items) I don't get this. You'

Re: Why is this blowing the stack, thought it was tail-recursive...

2008-07-13 Thread Fuzzyman
On Jul 13, 7:56 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Sat, 12 Jul 2008 19:25:18 -0400, Terry Reedy wrote: > > ssecorp wrote: > >> def fib(n): > >>     def fibt(a, b, n): > >>         if n <= 1: > >>             return b > >>         else: > >>             return fib

Re: Correct use of try,except and raise?

2008-07-13 Thread Ben Finney
Roy Smith <[EMAIL PROTECTED]> writes: > Ben Finney <[EMAIL PROTECTED]> wrote: > > > If you are passing a sequence conceptually, then it's more Pythonic to > > pass it as a sequence explicitly:: > > > > def __init__(self, items): > > """ Call with e.g. Stack(["foo", "bar"]) """ > >

Re: spam <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>

2008-07-13 Thread Arne Vajhøj
Kevin McMurtrie wrote: In article <[EMAIL PROTECTED]>, Lew <[EMAIL PROTECTED]> wrote: WDC wrote: BTW I reported it, yo should too. To whom did you report it, so that we may also report it there? Google does not accept spam complaints. Go ahead, try it. That's why they've been the #1 Usen

Re: Correct use of try,except and raise?

2008-07-13 Thread Roy Smith
In article <[EMAIL PROTECTED]>, Ben Finney <[EMAIL PROTECTED]> wrote: > Which "original class" are you referring to? The one posted by the > original poster of this thread had no "original list"; it gathered the > positional arguments (using '*items') into an 'items' parameter, which > *doesn't e

Re: spam <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>

2008-07-13 Thread donald
Arne Vajhøj wrote: Google does not accept spam complaints. Go ahead, try it. That's why they've been the #1 Usenet spamming tool for years now. What you're seeing is the spam slowly expanding into the software development groups. uk.railway is probably a random group added to confuse spam

Re: About wmi

2008-07-13 Thread Larry Bates
patrol wrote: I want to prevent some process from running. The code is in the following. I encounter some unexpected troubles. Probelm1: This program cannot terminate "scrcons.exe" and "FNPLicensingService.exe",which are system processes. Problem2:After a while, this program will abort by error

Re: spam

2008-07-13 Thread Lew
rickman wrote: On Jul 12, 9:21 am, Scott in SoCal <[EMAIL PROTECTED]> wrote: In message <[EMAIL PROTECTED]>, rickman <[EMAIL PROTECTED]> wrote: spam *PLONK!* I love the way that people who plonk others feel the need to inform everyone of it. That ranks up there with, "I know what you are,

Re: heapq question

2008-07-13 Thread Giampaolo Rodola'
On 13 Lug, 11:35, Duncan Booth <[EMAIL PROTECTED]> wrote: > "Giampaolo Rodola'" <[EMAIL PROTECTED]> wrote: > > Having said that I'd like to understand if there are cases where > > deleting or moving an element of the heap, causes heappop() to return > > an element which is not the smallest one. > >

wxPython code giving strange errors.

2008-07-13 Thread teh_sAbEr
I'm busy trying to learn wxPython, and i'm trying to run the following piece of code (its from the wxPyWiki tutorial): import wx ID_ABOUT = 101 ID_EXIT = 110 class MainWindow(wx.Frame): def __init__(self,parent,id,title): wx.Frame.__init__(self,parent,wx.ID_ANY,title,size=(200,100))

Re: Someone enlightened me

2008-07-13 Thread Gary Herron
Marcus Low wrote: Opps here is the mail again, incase my formatting is lost, can someone explain to me why this code behaves differently when "lister" and "self.lister" is swap remarked. class abc : # remark this later and unremark "self.lister" lister = [] def __init__ (self, val):

Re: wxPython code giving strange errors.

2008-07-13 Thread Thin Myrna
teh_sAbEr wrote: > I'm busy trying to learn wxPython, and i'm trying to run the following > piece of code (its from the wxPyWiki tutorial): > > import wx > > ID_ABOUT = 101 > ID_EXIT = 110 > > class MainWindow(wx.Frame): > def __init__(self,parent,id,title): > wx.Frame.__init__(self

SAX XML Parse Python error message

2008-07-13 Thread goldtech
SAX XML Parse Python error message Hi, My first attempt at SAX, but have an error message I need help with. I cite the error message, code, and xml below. Be grateful if anyone can tell me what the fix is. Thanks. >>> Traceback (most recent call last): File "C:\Python24\Lib\site-packages\python

Newbie Threading Question

2008-07-13 Thread Sparky
It seems strange, but I can't find a list of operating systems which support / don't support threading in Python. Can anyone point me in the right direction? Thanks, Sam -- http://mail.python.org/mailman/listinfo/python-list

Re: SAX XML Parse Python error message

2008-07-13 Thread Stefan Behnel
goldtech wrote: > My first attempt at SAX, but have an error message I need help with. Just in case you prefer writing readable code over debugging SAX code into existence, try lxml. http://codespeak.net/lxml/ Here is a presentation you might find interesting. http://codespeak.net/lxml/s5/lxml-

Unexpected default arguments behaviour (Maybe bug?)

2008-07-13 Thread sukkopera
Hi, I have just encountered a Python behaviour I wouldn't expect. Take the following code: class Parent: a = 1 def m (self, param = a): print "param = %d" % param class Child (Parent):

wxPython Tab

2008-07-13 Thread Sparky
Is there a way to get wxPython to change the visible tab in a notebook (like I have tab 1 open but the computer will automatically change to tab 2)? Thanks, Sam -- http://mail.python.org/mailman/listinfo/python-list

Re: wxPython Tab

2008-07-13 Thread Uwe Schmitt
On Jul 13, 6:20 pm, Sparky <[EMAIL PROTECTED]> wrote: > Is there a way to get wxPython to change the visible tab in a notebook > (like I have tab 1 open but the computer will automatically change to > tab 2)? > > Thanks, > Sam look at http://docs.wxwidgets.org/stable/wx_wxnotebook.html#wxnotebooks

Re: Building a Python app with Mozilla

2008-07-13 Thread happybrowndog
Is that why Komodo is so damned slow Brian Quinlan wrote: Kevin Walzer wrote: Komodo is not a Python application. It is a Mozilla application that supports Python development. Komodo is more akin to Thunderbird and Firefox than anything else; it uses the XUL framework for rendering widge

Magic?

2008-07-13 Thread mk
So I was playing around with properties and wrote this: class lstr(str): def __init__(self, initval): self._s = initval self._len = len(self._s) def fget_s(self): return str(self._s) def fset_s(self, val): self._s = val self._len

Re: spam

2008-07-13 Thread INVALID
rickman wrote: >I love the way that people who plonk others feel the need to inform >everyone of it. That ranks up there with, "I know what you are, but >what am I?" It is a matter of basic politeness and common courtesy. Without the plonk, the killfiled poster is left hanging in the wind, w

Re: Magic?

2008-07-13 Thread mk
However, it appears that somehow this object prints the value of 's' attribute without me setting any specific methods to do that: >>> astr = lstr('abcdef') >>> astr 'abcdef' >>> astr.swapcase() 'ABCDEF' Correction: it doesn't really get the value from _s attribute: >>> astr = lstr('abcd

Re: spam

2008-07-13 Thread Arne Vajhøj
[EMAIL PROTECTED] wrote: rickman wrote: I love the way that people who plonk others feel the need to inform everyone of it. That ranks up there with, "I know what you are, but what am I?" It is a matter of basic politeness and common courtesy. Without the plonk, the killfiled poster is left

Re: like py2exe, but on a mac

2008-07-13 Thread Tommy Nordgren
On 13 jul 2008, at 00.39, Alexnb wrote: Hi All I am wondering what I can do to turn a python app (.py) into a mac OSX applicaiton (.app). Just like py2exe does. But I am also wondering since in your applications folder on macs it usually doesn't have an actual folder for each app. Rather

Re: spam <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>

2008-07-13 Thread Arne Vajhøj
donald wrote: Arne Vajhøj wrote: Google does not accept spam complaints. Go ahead, try it. That's why they've been the #1 Usenet spamming tool for years now. What you're seeing is the spam slowly expanding into the software development groups. uk.railway is probably a random group added

Socket problems

2008-07-13 Thread jjbutler88
I am trying to write a simple python IRC client, roughly following this guide: http://www.devshed.com/c/a/Python/Python-and-IRC/ I have written some code, which uses the same commands as the guide, but I get this error: Traceback (most recent call last): File "/Library/Frameworks/Python.framewor

Re: heapq question

2008-07-13 Thread Martin v. Löwis
> I understand that heapq is not that efficient to implement timeouts as > I thought at first. > It would have been perfect if there were functions to remove arbitrary > elements withouth needing to re-heapify() the heap every time. It is efficient for that - you just need to use it correctly. To

Re: Unexpected default arguments behaviour (Maybe bug?)

2008-07-13 Thread marek . rocki
[EMAIL PROTECTED] napisał(a): > Hi, I have just encountered a Python behaviour I wouldn't expect. Take > the following code: > > > class Parent: > a = 1 > > def m (self, param = a): > print "param = %d" % param

Re: Beginner Question : Iterators and zip

2008-07-13 Thread Terry Reedy
[EMAIL PROTECTED] wrote: What is this *lis operation called? I am having trouble finding any reference to it in the python docs or the book learning python. One might call this argument unpacking, but Language Manual / Expressions / Primaries / Calls simply calls it *expression syntax. "If the

Mutually referencing imports -- impossible?

2008-07-13 Thread Matthew Wilson
I started off with a module that defined a class Vehicle, and then subclasses Car and Motorcycle. In the Car class, for some bizarre reason, I instantiated a Motorcycle. Please pretend that this can't be avoided for now. Meanwhile, my Motorcycle class instantiated a Car as well. Then I moved th

Re: Functional/Best?

2008-07-13 Thread Terry Reedy
Tim Cook wrote: I guess I can classify my application(s) as more procedural than anything else. But I have a question about the best way to handle something in Python. When given a mapping of keywords, I want to call a function based on a certain keyword found when parsing a text file. The m

Re: Mutually referencing imports -- impossible?

2008-07-13 Thread Gary Herron
Matthew Wilson wrote: I started off with a module that defined a class Vehicle, and then subclasses Car and Motorcycle. In the Car class, for some bizarre reason, I instantiated a Motorcycle. Please pretend that this can't be avoided for now. Meanwhile, my Motorcycle class instantiated a Car a

Re: Mutually referencing imports -- impossible?

2008-07-13 Thread Carl Banks
On Jul 13, 1:55 pm, Matthew Wilson <[EMAIL PROTECTED]> wrote: > I started off with a module that defined a class Vehicle, and then > subclasses Car and Motorcycle. > > In the Car class,  for some bizarre reason, I instantiated a Motorcycle. > Please pretend that this can't be avoided for now. > > M

Re: socket.connect() hangs in SYN_SENT state.

2008-07-13 Thread bukzor
On Jul 13, 1:14 am, Miles <[EMAIL PROTECTED]> wrote: > On Sat, Jul 12, 2008 at 11:23 PM, bukzor <[EMAIL PROTECTED]> wrote: > > I'm connecting to an apache2 process on the same machine, > > for testing. When looking at netstat, the socket is in the SYN_SENT > > state, like this: > > > $netstat -a -t

Re: Socket problems

2008-07-13 Thread Jonathon Sisson
SSL objects use "write", not "send". You also need to change this: self.sock.write('NICK %s\r\n') % self.nick to this: self.sock.write('NICK %s\r\n' % self.nick) If you don't, the interpreter will bomb on trying to concatenate the return value for "write" (an integer) with the string self.ni

spam

2008-07-13 Thread rickman
spam -- http://mail.python.org/mailman/listinfo/python-list

RE: Terminate a python script from linux shell / bash script

2008-07-13 Thread Gros Bedo
Thank you guys for your help. My problem is that I project to use this command to terminate a script when uninstalling the software, so I can't store the PID. This command will be integrated in the spec file of the RPM package. Here's the script I'll use, it may help someone else: #!/bin/sh #

Re: heapq question

2008-07-13 Thread Giampaolo Rodola'
On 13 Lug, 19:31, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > I understand that heapq is not that efficient to implement timeouts as > > I thought at first. > > It would have been perfect if there were functions to remove arbitrary > > elements withouth needing to re-heapify() the heap every t

Re: Newbie Threading Question

2008-07-13 Thread Nick Dumas
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I'm not an expert on Python threading, so don't take my word as low, however, I believe that there's no need for a list of systems which support it because the Python virtual machine handles it. Thus, any system which supports Python (or at least Pytho

Re: Mutually referencing imports -- impossible?

2008-07-13 Thread John Roth
On Jul 13, 11:55 am, Matthew Wilson <[EMAIL PROTECTED]> wrote: > I started off with a module that defined a class Vehicle, and then > subclasses Car and Motorcycle. > > In the Car class,  for some bizarre reason, I instantiated a Motorcycle. > Please pretend that this can't be avoided for now. > >

Generating Lip-Synched animation?

2008-07-13 Thread Miki
Hello, I'm trying to write something like http://blabberize.com/, generating a video file with lip-sync. Currently the general idea is: * Generate animation images using GIMP * Sample voice and detect when there is sound and when there is silence - Still working on details for this one, will pr

Re: socket.connect() hangs in SYN_SENT state.

2008-07-13 Thread Miles
On Sun, Jul 13, 2008 at 2:32 PM, bukzor <[EMAIL PROTECTED]> wrote: > On Jul 13, 1:14 am, Miles <[EMAIL PROTECTED]> wrote: >> On Sat, Jul 12, 2008 at 11:23 PM, bukzor <[EMAIL PROTECTED]> wrote: >> > I'm connecting to an apache2 process on the same machine, >> > for testing. When looking at netstat,

Re: heapq question

2008-07-13 Thread Duncan Booth
"Giampaolo Rodola'" <[EMAIL PROTECTED]> wrote: > Thanks, that's what I wanted to know. > I understand that heapq is not that efficient to implement timeouts as > I thought at first. > It would have been perfect if there were functions to remove arbitrary > elements withouth needing to re-heapify()

logging via SocketHandler and TCPserver

2008-07-13 Thread Larry Bates
Every time I look at the logging module (up until now) I've given up and continue to use my home-grown logger that I've been using for years. I'm not giving up this time ;-) I find that I REALLY need to be able to monitor LOTS of running programs/processes and thought it would be nice to hav

Re: heapq question

2008-07-13 Thread Miles
On Sun, Jul 13, 2008 at 3:05 PM, Giampaolo Rodola' <[EMAIL PROTECTED]> wrote: > On 13 Lug, 19:31, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: >> > I understand that heapq is not that efficient to implement timeouts as >> > I thought at first. >> > It would have been perfect if there were functions

Re: heapq question

2008-07-13 Thread Miles
On Sun, Jul 13, 2008 at 4:16 PM, Duncan Booth <[EMAIL PROTECTED]> wrote: > "Giampaolo Rodola'" <[EMAIL PROTECTED]> wrote: >> I understand that heapq is not that efficient to implement timeouts as >> I thought at first. >> It would have been perfect if there were functions to remove arbitrary >> ele

Re: SAX XML Parse Python error message

2008-07-13 Thread goldtech
I would be grateful for support with the code I cited. It's not long and fairly standard. I'm sure my error(s) would be glaring to more experienced coders. I appreciated the "heads-up" about other options but I would be grateful for help getting this code to run. Thanks On Jul 13, 11:47 am, Stef

Re: numeric emulation and the rich comparison operators

2008-07-13 Thread Ethan Furman
Gabriel Genellina wrote: En Thu, 10 Jul 2008 17:37:42 -0300, Ethan Furman <[EMAIL PROTECTED]> escribi�: Greetings, List! Still working on my Measure class, and my next question is... (drum roll please ;) What are the advantages of using __[eq|ne|lt|gt|le|ge]__ vs __cmp__? If your obje

Re: Magic?

2008-07-13 Thread Miles
On Sun, Jul 13, 2008 at 12:55 PM, mk <[EMAIL PROTECTED]> wrote: > So my updated question is where does this lstr() instance keep the original > value ('abcdef')? It obviously has smth to do with inheriting after str > class, but I don't get the details of the mechanism. Through the str.__new__ met

Re: SAX XML Parse Python error message

2008-07-13 Thread Waldemar Osuch
On Jul 13, 3:00 pm, goldtech <[EMAIL PROTECTED]> wrote: > I would be grateful for support with the code I cited. It's not long > and fairly standard. I'm sure my error(s) would be glaring to more > experienced coders. I appreciated the "heads-up" about other options > but I would be grateful for he

Re: SAX XML Parse Python error message

2008-07-13 Thread goldtech
On Jul 13, 5:30 pm, Waldemar Osuch <[EMAIL PROTECTED]> wrote: > On Jul 13, 3:00 pm, goldtech <[EMAIL PROTECTED]> wrote: > > > I would be grateful for support with the code I cited. It's not long > > and fairly standard. I'm sure my error(s) would be glaring to more > > experienced coders. I appreci

Re: Unexpected default arguments behaviour (Maybe bug?)

2008-07-13 Thread sukkopera
On 13 Lug, 19:42, [EMAIL PROTECTED] wrote: > I expect it's because default values for parameters are evaluated and > bound at definition time. So once "def m (self, param = a):" line > executes, the default value for parameter is forever bound to be 1. > What you can do is for example: Yes, that's

Re: Functional/Best?

2008-07-13 Thread Paul Hankin
On Jul 13, 7:00 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: > Tim Cook wrote: > > I guess I can classify my application(s) as more procedural than > > anything else.  But I have a question about the best way to handle > > something in Python. > > > When given a mapping of keywords, I want to call a

Using Groups inside Braces with Regular Expressions

2008-07-13 Thread Chris
I'm trying to delimit sentences in a block of text by defining the end-of-sentence marker as a period followed by a space followed by an uppercase letter or end-of-string. I'd imagine the regex for that would look something like: [^(?:[A-Z]|$)]\.\s+(?=[A-Z]|$) However, Python keeps giving me an

Re: Mutually referencing imports -- impossible?

2008-07-13 Thread John Machin
On Jul 14, 3:55 am, Matthew Wilson <[EMAIL PROTECTED]> wrote: > I started off with a module that defined a class Vehicle, and then > subclasses Car and Motorcycle. > > In the Car class, for some bizarre reason, I instantiated a Motorcycle. > Please pretend that this can't be avoided for now. > > M

Re: Mutually referencing imports -- impossible?

2008-07-13 Thread John Machin
On Jul 14, 5:30 am, John Roth <[EMAIL PROTECTED]> wrote: > On Jul 13, 11:55 am, Matthew Wilson <[EMAIL PROTECTED]> wrote: > > > > > I started off with a module that defined a class Vehicle, and then > > subclasses Car and Motorcycle. > > > In the Car class, for some bizarre reason, I instantiated

Dictionary bidirectional

2008-07-13 Thread Kless
I need a dictionary where get the result from a 'key' (on left), but also from a 'value' (on right), how to get it? I know that dictionaries aren't bidirectional, but is there any way without use two dictionaries? Thanks in advance! -- http://mail.python.org/mailman/listinfo/python-list

Re: wxPython code giving strange errors.

2008-07-13 Thread Mike Driscoll
On Jul 13, 10:18 am, teh_sAbEr <[EMAIL PROTECTED]> wrote: > I'm busy trying to learn wxPython, and i'm trying to run the following > piece of code (its from the wxPyWiki tutorial): > > import wx > > ID_ABOUT = 101 > ID_EXIT = 110 > > class MainWindow(wx.Frame): >     def __init__(self,parent,id,tit

Re: Dictionary bidirectional

2008-07-13 Thread WDC
On Jul 13, 4:21 pm, Kless <[EMAIL PROTECTED]> wrote: > I need a dictionary where get the result from a 'key' (on left), but > also from a 'value' (on right), how to get it? > > I know that dictionaries aren't bidirectional, but is there any way > without use two dictionaries? > > Thanks in advance!

Re: Using Groups inside Braces with Regular Expressions

2008-07-13 Thread MRAB
On Jul 14, 12:05 am, Chris <[EMAIL PROTECTED]> wrote: > I'm trying to delimit  sentences in a block of text by defining the > end-of-sentence marker as a period followed by a space followed by an > uppercase letter or end-of-string. > > I'd imagine the regex for that would look something like: > [^

How to package a logging.config file?

2008-07-13 Thread Matthew Wilson
I'm working on a package that uses the standard library logging module along with a .cfg file. In my code, I use logging.config.fileConfig('/home/matt/mypackage/matt.cfg') to load in the logging config file. However, it seems really obvious to me that this won't work when I share this package wit

Re: socket.connect() hangs in SYN_SENT state.

2008-07-13 Thread bukzor
On Jul 13, 1:08 pm, Miles <[EMAIL PROTECTED]> wrote: > On Sun, Jul 13, 2008 at 2:32 PM, bukzor <[EMAIL PROTECTED]> wrote: > > On Jul 13, 1:14 am, Miles <[EMAIL PROTECTED]> wrote: > >> On Sat, Jul 12, 2008 at 11:23 PM, bukzor <[EMAIL PROTECTED]> wrote: > >> > I'm connecting to an apache2 process on

Re: Dictionary bidirectional

2008-07-13 Thread bukzor
On Jul 13, 4:21 pm, Kless <[EMAIL PROTECTED]> wrote: > I need a dictionary where get the result from a 'key' (on left), but > also from a 'value' (on right), how to get it? > > I know that dictionaries aren't bidirectional, but is there any way > without use two dictionaries? > > Thanks in advance!

Re: Using Groups inside Braces with Regular Expressions

2008-07-13 Thread Chris
On Jul 13, 8:14 pm, MRAB <[EMAIL PROTECTED]> wrote: > On Jul 14, 12:05 am, Chris <[EMAIL PROTECTED]> wrote:> I'm trying to delimit > sentences in a block of text by defining the > > end-of-sentence marker as a period followed by a space followed by an > > uppercase letter or end-of-string. > > >

Re: Using Groups inside Braces with Regular Expressions

2008-07-13 Thread John Machin
On Jul 14, 9:05 am, Chris <[EMAIL PROTECTED]> wrote: Misleading subject. [] brackets or "square brackets" {} braces or "curly brackets" () parentheses or "round brackets" > I'm trying to delimit sentences in a block of text by defining the > end-of-sentence marker as a period followed by a spac

Re: Dictionary bidirectional

2008-07-13 Thread bearophileHUGS
bukzor: > You need to use two dictionaries. Here's a class that someone's > written that wraps it up into a single dict-like object for you: > http://www.faqts.com/knowledge_base/view.phtml/aid/4376 It contains code like: try: del self.data[item] except KeyError: pass Exceptions are usef

Re: About wmi

2008-07-13 Thread patrol
On 7月13日, 下午10时26分, Larry Bates <[EMAIL PROTECTED]> wrote: > patrol wrote: > > I want to prevent some process from running. The code is in the > > following. I encounter some unexpected troubles. > > Probelm1: This program cannot terminate "scrcons.exe" and > > "FNPLicensingService.exe",which are

Re: socket.connect() hangs in SYN_SENT state.

2008-07-13 Thread Miles
On Sun, Jul 13, 2008 at 8:35 PM, bukzor <[EMAIL PROTECTED]> wrote: > The problem only manifests about 1 in 20 runs. Below there's code for > a client that shows the problem 100% of the time. > > The two URL's that I seem to be "confused" about point to the same IP. > Maybe this will make it clear:

Re: socket.connect() hangs in SYN_SENT state.

2008-07-13 Thread Miles
On Sun, Jul 13, 2008 at 9:31 PM, Miles <[EMAIL PROTECTED]> wrote: > On Sun, Jul 13, 2008 at 8:35 PM, bukzor <[EMAIL PROTECTED]> wrote: >> The problem only manifests about 1 in 20 runs. Below there's code for >> a client that shows the problem 100% of the time. >> >> The two URL's that I seem to be

Re: iterator clone

2008-07-13 Thread Yosifov Pavel
> Well, I think Python's iterators, especially the generators, are beautiful. > More importantly, I think there is no general way to make iterators > copyable, regardless of the programming language. The problem is that most > of the useful ones depend on external state. > > Peter Hmm, but tee() d

Re: Dictionary bidirectional

2008-07-13 Thread Larry Bates
[EMAIL PROTECTED] wrote: bukzor: You need to use two dictionaries. Here's a class that someone's written that wraps it up into a single dict-like object for you: http://www.faqts.com/knowledge_base/view.phtml/aid/4376 It contains code like: try: del self.data[item] except KeyError: pa

Re: How to package a logging.config file?

2008-07-13 Thread Larry Bates
Matthew Wilson wrote: I'm working on a package that uses the standard library logging module along with a .cfg file. In my code, I use logging.config.fileConfig('/home/matt/mypackage/matt.cfg') to load in the logging config file. However, it seems really obvious to me that this won't work when

Re: heapq question

2008-07-13 Thread Giampaolo Rodola'
On 13 Lug, 22:35, Miles <[EMAIL PROTECTED]> wrote: > On Sun, Jul 13, 2008 at 3:05 PM, Giampaolo Rodola' <[EMAIL PROTECTED]> wrote: > > On 13 Lug, 19:31, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > >> > I understand that heapq is not that efficient to implement timeouts as > >> > I thought at fir

Re: Dictionary bidirectional

2008-07-13 Thread Akathorn Greyhat
-- Forwarded message -- From: Akathorn Greyhat <[EMAIL PROTECTED]> Date: 2008/7/14 Subject: Re: Dictionary bidirectional To: Kless <[EMAIL PROTECTED]> 2008/7/14 Kless <[EMAIL PROTECTED]>: I need a dictionary where get the result from a 'key' (on left), but > also from a 'value'

Re: socket.connect() hangs in SYN_SENT state.

2008-07-13 Thread Miles
On Sat, Jul 12, 2008 at 11:23 PM, bukzor <[EMAIL PROTECTED]> wrote: > Anyone know a general reason this might happen? Even better, a way to > fix it? Another reason that a socket can hang in the SYN_SENT state (besides trying to connect to an unreachable host without getting an ICMP destination-un

Re: socket.connect() hangs in SYN_SENT state.

2008-07-13 Thread Miles
On Sun, Jul 13, 2008 at 10:29 PM, Miles <[EMAIL PROTECTED]> wrote: > On Sat, Jul 12, 2008 at 11:23 PM, bukzor <[EMAIL PROTECTED]> wrote: >> Anyone know a general reason this might happen? Even better, a way to >> fix it? > > Maybe your client has an unusually low socket timeout for some reason, > t

Re: wxPython Tab

2008-07-13 Thread Sparky
On Jul 13, 10:32 am, Uwe Schmitt <[EMAIL PROTECTED]> wrote: > On Jul 13, 6:20 pm, Sparky <[EMAIL PROTECTED]> wrote: > > > Is there a way to get wxPython to change the visible tab in a notebook > > (like I have tab 1 open but the computer will automatically change to > > tab 2)? > > > Thanks, > > Sa

Re: Newbie Threading Question

2008-07-13 Thread Sparky
On Jul 13, 1:30 pm, Nick Dumas <[EMAIL PROTECTED]> wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > I'm not an expert on Python threading, so don't take my word as low, > however, I believe that there's no need for a list of systems which > support it because the Python virtual machine

Malaysia python user group

2008-07-13 Thread Marcus.CM
Hi, I am thinking of promoting Python for the local developers here in Malaysia, via Universities , seminars etc . Is there already a user group here in Malaysia? Any pointers would help. Marcus. -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >