accessor/mutator functions

2005-02-25 Thread mirandacascade
When I look at how classes are set up in other languages (e.g. C++), I often observe the following patterns: 1) for each data member, the class will have an accessor member function (a Get function) 2) for each data member, the class will have a mutator member function (a Set function) 3) data memb

Re: Default value for Listbox (Tkinter)

2005-02-25 Thread Harlin Seritt
Thanks Jorgen! I was reading the Tkinter tutorial (I was looking at this particular page: http://www.pythonware.com/library/tkinter/introduction/x5513-methods.htm) and saw this for select_set(): select_set(index), select_set(first, last) Add one or more items to the selection. I think this was

Re: accessor/mutator functions

2005-02-25 Thread Michael Spencer
[EMAIL PROTECTED] wrote: When I look at how classes are set up in other languages (e.g. C++), I often observe the following patterns: 1) for each data member, the class will have an accessor member function (a Get function) 2) for each data member, the class will have a mutator member function (a S

Re: wxpython tutorials

2005-02-25 Thread Brian
Raghul, The second link Harlin gave is to the wxPython wiki - it has a variety of pages with information about the toolkit including a number of tutorial pages. The "Getting Started" document linked on the main page is pretty thorough. Once you comfortable with some of the basic concepts, I'd su

Re: web status display for long running program

2005-02-25 Thread Simon Wittber
> I was inspired to enhance your code, and perform a critical bug-fix. > Your code would not have sent large files out to dialup users, because > it assumed all data was sent on the 'send' command. I added code to > check for the number of bytes sent, and loop until it's all gone. Another solutio

Re: accessor/mutator functions

2005-02-25 Thread Simon Wittber
> My questions are: > a) Are the three things above considered pythonic? Python uses a function called 'property to achieve the same effect. This example is taken from the documentation: class C(object): def __init__(self): self.__x = 0 def getx(self):

Re: duplicate file finder

2005-02-25 Thread TZOTZIOY
On Thu, 24 Feb 2005 15:32:03 -0800, rumours say that Lowell Kirsh <[EMAIL PROTECTED]> might have written: >It looks pretty good, but I'll have to take a better look later. Out of >curiosity, why did you convert the first spaces to pipes rather than add >the code as an attachment? (As you probab

Python Online Programming Contest

2005-02-25 Thread Varun
Hi Friends, Department of Information Technology, Madras Institute of Technology, Anna University, India is conducting a technical symposium, Samhita. As a part of samhita, an Online Programming Contest is scheduled on Sunday, 27 Feb 2005. This is the first Online Programming Contest in India to

Python Online Programming Contest

2005-02-25 Thread Varun
Hi Friends, Department of Information Technology, Madras Institute of Technology, Anna University, India is conducting a technical symposium, Samhita. As a part of samhita, an Online Programming Contest is scheduled on Sunday, 27 Feb 2005. This is the first Online Programming Contest in India to

auto-completion history

2005-02-25 Thread porterboy
Hi Folks, I have auto-completion set up in my python interpreter so that if I hit the tab key it will complete a variable or a python command*. eg. if I type >>> imp and if I then hit the tab key, the interpreter will complete it to... >>> import Now, I also use Matlab at the command line a lot a

Re: wxpython tutorials

2005-02-25 Thread Fuzzyman
Raghul wrote: > hi, > > I want to learn Wxpython to work in windows.Is there any tutorials > available?Pls specify the link that will be easy to learn for beginers > like me I'm just learning wxPython, but rather than do it directly I'm using wax. wax is another layer that sits on top of wxPy

Re: wanted: C++ parser written in Python

2005-02-25 Thread Franz Steinhaeusler
On Fri, 25 Feb 2005 15:10:06 +0800, "mep" <[EMAIL PROTECTED]> wrote: >Try ANTLR with python code generation: >http://www.antlr.org/ > >And C++ grammers: >http://www.antlr.org/grammar/cpp > >You can generate a c++ parser in python with the above. Thank you, but it is too big. Anyway: I'm looking

how to use property

2005-02-25 Thread neutrinman
My question is how should I use "property" which wraps up (B__get_channel() and __set_channel()in the following program. (BI tried the program that written below, and it worked. Then I tried: (Bchannel = property(__get_channel,__set_channel) as in comment 1, 2, (Band 3, (B (Bbut it genera

automatic nesting and indentation in emacs

2005-02-25 Thread porterboy
CONTEXT: I am using Emacs to edit Python code and sometimes also Matlab code. When I hit in a loop of some sort, Emacs usually gets the nesting indentation right, which is particularly important in Python. To ensure this I have used python-mode.el and matlab.el modes in emacs. QUESTION: If I sudd

Re: wanted: C++ parser written in Python

2005-02-25 Thread Ville Vainio
> "Franz" == Franz Steinhaeusler <[EMAIL PROTECTED]> writes: Franz> Thank you, but it is too big. Franz> Anyway: Franz> I'm looking for some (simple) "rules" to parse (regex) and Franz> try to implement myself, if nothing is available. Check out http://pyparsing.sourceforge

Re: Shift Confusion

2005-02-25 Thread Lars
Hi Kamilche, Aside from the 7bit confusion you should take a look at the 'struct' module. I bet it will simplify your life considerably. #two chars >>> import struct >>> struct.pack('cc','A','B') 'AB' #unsigned short + two chars >>> struct.pack('Hcc',65535,'a','b') '\xff\xffab' Cheers Lars --

Re: automatic nesting and indentation in emacs

2005-02-25 Thread Thomas Heller
[EMAIL PROTECTED] (porterboy) writes: > CONTEXT: > I am using Emacs to edit Python code and sometimes also Matlab code. > When I hit in a loop of some sort, Emacs usually gets the > nesting indentation right, which is particularly important in Python. > To ensure this I have used python-mode.el a

Re: wanted: C++ parser written in Python

2005-02-25 Thread Franz Steinhaeusler
On 25 Feb 2005 12:38:53 +0200, Ville Vainio <[EMAIL PROTECTED]> wrote: Hello Ville, >> "Franz" == Franz Steinhaeusler <[EMAIL PROTECTED]> writes: > >Franz> Thank you, but it is too big. > >Franz> Anyway: > >Franz> I'm looking for some (simple) "rules" to parse (regex) and >Fra

Re: web status display for long running program

2005-02-25 Thread Michele Simionato
This is fun, so I will give my solution too (of course, the effort here is to give the shortest solution, not the more robust solution ;). This is the server program, which just counts forever: from threading import Thread from CGIHTTPServer import test import os class Counter(Thread): def r

xhtml-print parser

2005-02-25 Thread p . nagarajkumar
my question is i have parsed the xhtml data stream using c i need to diplay the content present in the command prompt as the data present in the webpage as links how it can be done? -- http://mail.python.org/mailman/listinfo/python-list

Re: Trees

2005-02-25 Thread Harlin Seritt
Would this be for a GUI toolkit or maybe using a standard class scheme? -- http://mail.python.org/mailman/listinfo/python-list

Re: wanted: C++ parser written in Python

2005-02-25 Thread Chris Smith
> "Franz" == Franz Steinhaeusler <[EMAIL PROTECTED]> writes: Franz> On 25 Feb 2005 12:38:53 +0200, Ville Vainio <[EMAIL PROTECTED]> wrote: Franz> Hello Ville, >>> "Franz" == Franz Steinhaeusler >>> <[EMAIL PROTECTED]> writes: >> Franz> Thank you, but it is to

Re: Interesting decorator use.

2005-02-25 Thread Chris Smith
> "Tom" == Tom Willis <[EMAIL PROTECTED]> writes: Tom> Pretty slick that python can have AOP-like features sort of Tom> out of the box. One wonders if there will not be py>import AOP in the pythonic future. These decorators could lead to byzantine trees of @. Now, if the decorators st

Re: xhtml-print parser

2005-02-25 Thread Michael Hoffman
[EMAIL PROTECTED] wrote: my question is i have parsed the xhtml data stream using c That's not a question. And this is a language for discussing Python, not C. i need to diplay the content present in the command prompt as the data present in the webpage as links how it can be done? http://www.catb.

ANN: Leo 4.3-a3 Outlining IDE

2005-02-25 Thread Edward K. Ream
Leo 4.3 alpha 3 is now available at http://sourceforge.net/projects/leo/ Leo 4.3 is the culmination of more than five months of work. This alpha 3 release corrects various bugs in Leo's core and in plugins. This is the first release that include an installer for MacOSX. The defining features of L

Re: Leo 4.3-a3 Outlining IDE

2005-02-25 Thread Edward K. Ream
I really only posted this once to comp.lang.python. The duplicate appears to be the work of the Department of Redundancy Department. Edward Edward K. Ream email: [EMAIL PROTECTED] Leo: Literate Editor with Outlines Leo: http

Re: automatic nesting and indentation in emacs

2005-02-25 Thread Chris Smith
> Thomas Heller <[EMAIL PROTECTED]> writes: > [EMAIL PROTECTED] (porterboy) writes: >> CONTEXT: I am using Emacs to edit Python code and sometimes >> also Matlab code. When I hit in a loop of some sort, >> Emacs usually gets the nesting indentation right, which is >> part

Re: Vectors in Visual Python

2005-02-25 Thread Diez B. Roggisch
FLChamp wrote: > If anything was addressed to my problem then it has completely passed > me by as most points were clearly made by a computer scientist and I am > not one of those in the slightest. My experience of using any type of > programming language is limited to the little we are taught in

Re: Trees

2005-02-25 Thread Fuzzyman
Alex Le Dain wrote: > Is there a generic "tree" module that can enable me to sort and use > trees (and nodes). Basically having methods such as .AddNode(), > .GetAllChildren(), .FindNode() etc. > > Is this handled natively with any of the core modules? > > cheers, Alex. > > -- > Poseidon Scientifi

Re: auto-completion history

2005-02-25 Thread Serge Orlov
porterboy wrote: > Hi Folks, > > I have auto-completion set up in my python interpreter so that if I > hit the tab key it will complete a variable or a python command*. eg. > if I type > >>> imp > and if I then hit the tab key, the interpreter will complete it to... > >>> import > > Now, I also use

Re: Trees

2005-02-25 Thread Diez B. Roggisch
Alex Le Dain wrote: > Is there a generic "tree" module that can enable me to sort and use > trees (and nodes). Basically having methods such as .AddNode(), > .GetAllChildren(), .FindNode() etc. No. Usually, one uses the built-in python datastructures for this. E.g. ('root', [('child1', None), (

Re: wxpython tutorials

2005-02-25 Thread Kartic
Raghul said the following on 2/25/2005 12:24 AM: hi, I want to learn Wxpython to work in windows.Is there any tutorials available?Pls specify the link that will be easy to learn for beginers like me Raghul - If you have the patience, you can look at the demo source code. A good thing about th

Re: Trees

2005-02-25 Thread François Pinard
[Alex Le Dain] > Is there a generic "tree" module that can enable me to sort and use > trees (and nodes). Basically having methods such as .AddNode(), > .GetAllChildren(), .FindNode() etc. > Is this handled natively with any of the core modules? Using only standard Python, look at the suite of `

Re: how to use property

2005-02-25 Thread dodoo
try this: self.channel = choice -- http://mail.python.org/mailman/listinfo/python-list

strange SyntaxError

2005-02-25 Thread Attila Szabo
Hi, I wrote this sample piece of code: def main(): lambda x: 'ABC%s' % str(x) for k in range(2): exec('print %s' % k) main() With the lambda line, I get this: SyntaxError: unqualified exec is not allowed in function 'main' it con

split a directory string into a list

2005-02-25 Thread porterboy76
QUESTION: How do I split a directory string into a list in Python, eg. '/foo/bar/beer/sex/cigarettes/drugs/alcohol/' becomes ['foo','bar','beer','sex','cigarettes','drugs','alcohol'] I was looking at the os.path.split command, but it only seems to separate the filename from the path (or am I j

Re: xhtml-print parser

2005-02-25 Thread Steve Holden
Michael Hoffman wrote: [EMAIL PROTECTED] wrote: my question is i have parsed the xhtml data stream using c That's not a question. And this is a language for discussing Python, not C. Whoa, there! Ease off that trigger-finger, pardner ... i need to diplay the content present in the command prompt a

Re: split a directory string into a list

2005-02-25 Thread Kent Johnson
[EMAIL PROTECTED] wrote: QUESTION: How do I split a directory string into a list in Python, eg. '/foo/bar/beer/sex/cigarettes/drugs/alcohol/' becomes ['foo','bar','beer','sex','cigarettes','drugs','alcohol'] >>> '/foo/bar/beer/sex/cigarettes/drugs/alcohol/'.strip('/').split('/') ['foo', 'bar', 'be

Re: how to use property

2005-02-25 Thread Kartic
[EMAIL PROTECTED] said the following on 2/25/2005 5:25 AM: (B> My question is how should I use "property" which wraps up (B> __get_channel() and __set_channel()in the following program. (B> I tried the program that written below, and it worked. Then I tried: (B> channel = property(__get_cha

genetic algorithms

2005-02-25 Thread Jelle Feringa / EZCT Architecture & Design Research
Could anyone recommend me a genetic algorithm package? So far I have found a few, such as GAS, pyGP, Genetic, and of course scipy.ga My problem is that most of the development of these packages seems to be stalled, or that in scipy.ga's case, the module seems huge and somewhat overly complicated.

Re: automatic nesting and indentation in emacs

2005-02-25 Thread Ben Barrowes
In emacs matlab-mode, highlight a region then use indent-region: C-M-\ runs the command indent-region which is an interactive compiled Lisp function in `indent'. (indent-region START END COLUMN) Indent each nonblank line in the region. With prefix no argument, indent each line using `indent-acco

RE: split a directory string into a list

2005-02-25 Thread Harper, Gina
I would start with something like this: somestring = '/foo/bar/beer/sex/cigarettes/drugs/alcohol/' somelist = somestring.split('/') print somelist This is close to what you seem to want. Good luck. *gina* -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday,

Re: xhtml-print parser

2005-02-25 Thread Michael Hoffman
Steve Holden wrote: Consider that the OP might want to pass the C parser output to a Python web-content generator, which would make a deal of sense. You're welcome to guess what the OP wants to do, but I'm not going to. If he or she asks a coherent question it will probably be answered. -- Michael

Re: split a directory string into a list

2005-02-25 Thread Michael Maibaum
On 25 Feb 2005, at 14:09, Harper, Gina wrote: I would start with something like this: somestring = '/foo/bar/beer/sex/cigarettes/drugs/alcohol/' somelist = somestring.split('/') print somelist However - this will not work on Windows. It'd work on all the OS I usually use though ;) Michael -- htt

Re: web status display for long running program

2005-02-25 Thread Larry Bates
Not exactly on point, but this is what I use in many of my programs to show progress on long running console apps. Larry Bates class progressbarClass: def __init__(self, finalcount, progresschar=None): import sys self.finalcount=finalcount self.blockcount=0 #

ANN: T602Parser 0.1

2005-02-25 Thread Radovan Garabik
Text602 was a very popular word processor for IBM PC MS DOS compatibles, used in Czechoslovakia. T602Parser provides a simple class modelled after HTMLParser that can be used to parse Text602 documents (MS DOS version, not Win602) and to extract/convert data contained in them. Version: 0.1 (in

Is there way to determine which class a method is bound to?

2005-02-25 Thread Victor Ng
I'm doing some evil things in Python and I would find it useful to determine which class a method is bound to when I'm given a method pointer. For example: class Foo(object): def somemeth(self): return 42 class Bar(Foo): def othermethod(self): return 42 Is there some wa

Re: Is there way to determine which class a method is bound to?

2005-02-25 Thread Richie Hindle
[vic] > I'm doing some evil things in Python and I would find it useful to > determine which class a method is bound to when I'm given a method > pointer. Here you go: >>> class Foo: ... def bar(self): ... pass ... >>> Foo.bar.im_class >>> Foo().bar.im_class >>> -- Richie Hindle [EMAIL

Re: strange SyntaxError

2005-02-25 Thread Scott David Daniels
Attila Szabo wrote: Hi, def main(): lambda x: 'ABC%s' % str(x) for k in range(2): exec('print %s' % k) OK, to no real effect, in main you define an unnamed function that you can never reference. Pretty silly, but I'll bite. Next you run run a loop with exec looking like you think i

Re: Is there way to determine which class a method is bound to?

2005-02-25 Thread Victor Ng
No - that doesn't work, im_class gives me the current class - in the case of inheritance, I'd like to get the super class which provides 'bar'. I suppose I could walk the __bases__ to find the method using the search routine outlined in: http://www.python.org/2.2/descrintro.html but I was hoping

Re: Nevow examples

2005-02-25 Thread Chris
Does anyone know of a site(s) that shows examples of what you can do with Nevow? I'm not necessarily referring to code, but what it can do over the web. (Something I can show my boss if needed.) In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says... > > There was a request for nevow exam

problem installing wxPython 2.5.3, wxWidgets installed ok

2005-02-25 Thread timothy . williams
I'm trying to install wxPython 2.5.3.1 using Python 2.3.2 on a Fedora 2 machine. I have python in a non-standard place, but I'm using --prefix with the configure script to point to where I have everything. The make install in $WXDIR seemed to go fine. I have the libxw* libraries in my lib/ directo

Re: split a directory string into a list

2005-02-25 Thread Duncan Booth
Michael Maibaum wrote: > On 25 Feb 2005, at 14:09, Harper, Gina wrote: > >> I would start with something like this: >> somestring = '/foo/bar/beer/sex/cigarettes/drugs/alcohol/' >> somelist = somestring.split('/') >> print somelist > > However - this will not work on Windows. It'd work on all th

Re: Is there way to determine which class a method is bound to?

2005-02-25 Thread Peter Otten
Victor Ng wrote: > I'm doing some evil things in Python and I would find it useful to > determine which class a method is bound to when I'm given a method > pointer. > > For example: > > class Foo(object): > def somemeth(self): > return 42 > > class Bar(Foo): > def othermethod(s

Re: Is there way to determine which class a method is bound to?

2005-02-25 Thread Victor Ng
Awesome! I didn't see the getmro function in inspect - that'll do the trick for me. I should be able to just look up the methodname in each of the class's __dict__ attributes. vic On Fri, 25 Feb 2005 16:29:25 +0100, Peter Otten <[EMAIL PROTECTED]> wrote: > Victor Ng wrote: > > > I'm doing som

Re: Is there way to determine which class a method is bound to?

2005-02-25 Thread Peter Otten
Peter Otten wrote: import inspect class Foo(object): > ... def foo(self): pass > ... class Bar(Foo): > ... def bar(self): pass > ... def get_imp_class(method): > ... return [t for t in inspect.classify_class_attrs(method.im_class) > if t[-1] is method.im_func][0][2]

Re: accessor/mutator functions

2005-02-25 Thread mirandacascade
If the class had two attributes--x and y--would the code look like something lik this: class C(object): def __init__(self): self.__x = 0 self.__y = 0 def getx(self): return self.__x def setx(self, x): if x < 0: x = 0

Splitting strings - by iterators?

2005-02-25 Thread Jeremy Sanders
I have a large string containing lines of text separated by '\n'. I'm currently using text.splitlines(True) to break the text into lines, and I'm iterating over the resulting list. This is very slow (when using 40 lines!). Other than dumping the string to a file, and reading it back using the

Re: Is there way to determine which class a method is bound to?

2005-02-25 Thread Robin Becker
Victor Ng wrote: I'm doing some evil things in Python and I would find it useful to determine which class a method is bound to when I'm given a method pointer. For example: class Foo(object): def somemeth(self): return 42 class Bar(Foo): def othermethod(self): return 42 Is t

Re: Is there way to determine which class a method is bound to?

2005-02-25 Thread Roy Smith
In article <[EMAIL PROTECTED]>, Victor Ng <[EMAIL PROTECTED]> wrote: >I'm doing some evil things in Python and I would find it useful to >determine which class a method is bound to when I'm given a method >pointer. I don't know where (or if) it's documented, but im_class seems to give you what yo

Re: Is there way to determine which class a method is bound to?

2005-02-25 Thread Roy Smith
In article <[EMAIL PROTECTED]>, Victor Ng <[EMAIL PROTECTED]> wrote: >No - that doesn't work, im_class gives me the current class - in the >case of inheritance, I'd like to get the super class which provides >'bar'. Oh my. You said you were doing something evil, but didn't say *how* evil. What

Re: accessor/mutator functions

2005-02-25 Thread Diez B. Roggisch
> Because if so, does the term 'lazy evaluation' refer to the fact that > instead of: No, it is a common technical term. It means that a value is computed the time it is requested for the first time. Like this: class Foo(object): def __init__(self): self.__bar = None def getBar(se

Re: Splitting strings - by iterators?

2005-02-25 Thread Diez B. Roggisch
Jeremy Sanders wrote: > I have a large string containing lines of text separated by '\n'. I'm > currently using text.splitlines(True) to break the text into lines, and > I'm iterating over the resulting list. > > This is very slow (when using 40 lines!). Other than dumping the > string to a f

Re: update images inside a mysql database

2005-02-25 Thread Jonas Meurer
On 25/02/2005 Dennis Lee Bieber wrote: > On Thu, 24 Feb 2005 23:10:48 +0100, Jonas Meurer <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > > > version used placeholders as well. anyway, i changed my code to resemble > > "resemble" is the key... It is NOT the correct s

Re: Splitting strings - by iterators?

2005-02-25 Thread Jeremy Sanders
On Fri, 25 Feb 2005 17:14:24 +0100, Diez B. Roggisch wrote: > Maybe [c]StringIO can be of help. I don't know if it's iterator is lazy. But > at least it has one, so you can try and see if it improves performance :) Excellent! I somehow missed that module. StringIO speeds up the iteration by a fac

Re: Splitting strings - by iterators?

2005-02-25 Thread Larry Bates
Jeremy, How did you get the string in memory in the first place? If you read it from a file, perhaps you should change to reading it from the file a line at the time and use file.readline as your iterator. fp=file(inputfile, 'r') for line in fp: ...do your processing... fp.close() I don't t

Fonts

2005-02-25 Thread phil
I'm cpmpletely lost on fonts. I'm using Tkinter I do medarial = '-*-Arial-Bold-*-*--24-*-*-*-ISO8859-1" or Courier or Fixed in various sizes. Works great on my RH 7.2 But a small embedded system Im working on, nothing seems to work, almost everything falls back to a fixed 12 The X*4 fontpaths are t

Re: xhtml-print parser

2005-02-25 Thread Steve Holden
Michael Hoffman wrote: Steve Holden wrote: Consider that the OP might want to pass the C parser output to a Python web-content generator, which would make a deal of sense. You're welcome to guess what the OP wants to do, but I'm not going to. If he or she asks a coherent question it will probably

Re: Splitting strings - by iterators?

2005-02-25 Thread Jeremy Sanders
On Fri, 25 Feb 2005 10:57:59 -0600, Larry Bates wrote: > How did you get the string in memory in the first place? They're actually from a generated python script, acting as a saved file format, something like: interpret(""" lots of lines """) another_command() Obviously this isn't the most effi

Re: accessor/mutator functions

2005-02-25 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > When I look at how classes are set up in other languages (e.g. C++), I > often observe the following patterns: > 1) for each data member, the class will have an accessor member > function (a Get function) > 2) for each data member, the

Re: Unit testing - one test class/method, or test class/class

2005-02-25 Thread aurora
I do something more or less like your option b. I don't think there is any orthodox structure to follow. You should use a style that fit your taste. What I really want to bring up is your might want to look at refactoring your module in the first place. 348 test cases for one module sounds lik

Re: accessor/mutator functions

2005-02-25 Thread Michael Spencer
[EMAIL PROTECTED] wrote: If the class had two attributes--x and y--would the code look like something lik this: class C(object): def __init__(self): self.__x = 0 self.__y = 0 def getx(self): return self.__x def setx(self, x):

Re: Unit testing - one test class/method, or test class/class

2005-02-25 Thread John Roth
I tend to write one test class per class, but that's just the way I got started. My feeling is that the methods in a test class should tell a story if you read the names in the order they were written, so I'd split the tests for a class into several classes if they had different stories to tell. Jo

Re: split a directory string into a list

2005-02-25 Thread Josef Meile
Hi Duncan, This should work reasonably reliably on Windows and Unix: somestring = '/foo/bar/beer/sex/cigarettes/drugs/alcohol/' os.path.normpath(somestring).split(os.path.sep) ['', 'foo', 'bar', 'beer', 'sex', 'cigarettes', 'drugs', 'alcohol'] However a better solution is probably to call os.path.

Re: Tuple index

2005-02-25 Thread Scott Robinson
On 21 Feb 2005 15:01:05 -0800, "John Machin" <[EMAIL PROTECTED]> wrote: > >Steve M wrote: >> John Machin wrote: >> >> > >> > Steve M wrote: >> >> I'm actually doing this as part of an exercise from a book. What >the >> > program >> >> is supposed to do is be a word guessing game. The program >auto

Re: Threading and consuming output from processes

2005-02-25 Thread Donn Cave
In article <[EMAIL PROTECTED]>, Jack Orenstein <[EMAIL PROTECTED]> wrote: > I am developing a Python program that submits a command to each node > of a cluster and consumes the stdout and stderr from each. I want all > the processes to run in parallel, so I start a thread for each > node. There co

Re: strange SyntaxError

2005-02-25 Thread Terry Reedy
"Attila Szabo" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > I wrote this sample piece of code: > > def main(): >lambda x: 'ABC%s' % str(x) >for k in range(2): exec('print %s' % k) > > main() > > With the lambda line, I get this: > SyntaxError: unqualified

Re: [Tutor] threads

2005-02-25 Thread Shitiz Bansal
> >Can anyone guide me on how to spawn > >simultaneously( or > > pseudo simultaneously) running microthreads using > > stackless. > > > > Here is what i tried.. > > > > def gencars(num,origin,dest,speed): > > global adjls > > global cars > > global juncls > > for i in range(num):

Minor, but annoying legend problem in matplotlib

2005-02-25 Thread Jorl Shefner
I have a problem that I run into a lot with the 'legend' command's default behavior. I've found a work-around but I wonder if there's a better way. For a simple example, take the following: x= [1,2,3,4,5,6,7,8] a= [5,3,2,4,6,5,8,7] b= [4,1,3,

Re: Trouble with mysql-python 1.2.0 on Solaris 8 sparc

2005-02-25 Thread Andy Dustman
What happens when you try to connect? Be sure to check /etc/hosts.allow and .deny on the server, if your server is compiled with TCP wrapper support. -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there way to determine which class a method is bound to?

2005-02-25 Thread [EMAIL PROTECTED]
Another way is to make a simple metaclass, setting an attribute (like defining_class, or something) on each function object in the class dictionary. -- http://mail.python.org/mailman/listinfo/python-list

Re: wanted: C++ parser written in Python

2005-02-25 Thread dan . gass
You can look at the techniques and regular expressions in the testgen.c.unit test module that is part of a generic test framework called TestGen. TestGen uses a parser to automatically stub / copy functions for testing purposes. The parser is capable of identifying the function/method name as wel

Converting HTML to ASCII

2005-02-25 Thread gf gf
Hans, Thanks for the tip. I took a look at Beatiful Soup, and it looked like it was a framework to parse HTML. I'm not really interetsed in going through it tag by tag - just to get it converted to ASCII. How can I do this with B. Soup? --Thanks PS William - thanks for the reference to lynx,

Re: Unit testing - one test class/method, or test class/class

2005-02-25 Thread Edvard Majakari
aurora <[EMAIL PROTECTED]> writes: > What I really want to bring up is your might want to look at refactoring > your module in the first place. 348 test cases for one module sounds like a > large number. That reflects you have a fairly complex module to be tested > to start with. Often the bigges

Re: Unit testing - one test class/method, or test class/class

2005-02-25 Thread Edvard Majakari
"John Roth" <[EMAIL PROTECTED]> writes: > I tend to write one test class per class, but that's > just the way I got started. My feeling is that the > methods in a test class should tell a story if you > read the names in the order they were written, > so I'd split the tests for a class into severa

Re: wxpython tutorials

2005-02-25 Thread Bill
Raghul wrote: > hi, > > I want to learn Wxpython to work in windows.Is there any tutorials > available?Pls specify the link that will be easy to learn for beginers > like me An approach that I find useful is to use an IDE to build the base application structure, then examine the generated cod

Handle user abort

2005-02-25 Thread Markus Franz
Hallo! I use Python mostly for CGI (using Apache). And now I habe a problem: How can I handle the situation if a user clicks on ?abort? in the browser? It seems that a CGI-script is NOT stopped at this point. Is there any signal send to the CGI-process if the user clicks on ?abort?? Thank you. Be

Handle user abort inside of a CGI-script

2005-02-25 Thread Markus Franz
Hallo! I use Python mostly for CGI (Apache). And now I habe a problem: How can I handle the situation if a user clicks on "abort" in the browser? It seems that a CGI-script is NOT stopped at this point. Is there any signal send to the CGI-process if the user clicks on "abort"? Thank you. Best r

Re: Converting HTML to ASCII

2005-02-25 Thread Michael Spencer
gf gf wrote: [wants to extract ASCII from badly-formed HTML and thinks BeautifulSoup is too complex] You haven't specified what you mean by "extracting" ASCII, but I'll assume that you want to start by eliminating html tags and comments, which is easy enough with a couple of regular expressions:

Re: Flushing print()

2005-02-25 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Daniel Yoo <[EMAIL PROTECTED]> wrote: >gf gf <[EMAIL PROTECTED]> wrote: . . . >: If not, how can I flush it manually? sys.stdout.flush() didn't >: seem to work. > >H, that's odd. sys.stdou

Re: Splitting strings - by iterators?

2005-02-25 Thread Francis Girard
Hi, Using finditer in re module might help. I'm not sure it is lazy nor performant. Here's an example : === BEGIN SNAP import re reLn = re.compile(r"""[^\n]*(\n|$)""") sStr = \ """ This is a test string. It is supposed to be big. Oh well. """ for oMatch in reLn.finditer(sStr): print oMatch.

Re: [perl-python] generic equivalence partition

2005-02-25 Thread Paul Moore
David Eppstein <[EMAIL PROTECTED]> writes: > In article <[EMAIL PROTECTED]>, > "Xah Lee" <[EMAIL PROTECTED]> wrote: > >> parti(aList, equalFunc) >> >> given a list aList of n elements, we want to return a list that is a >> range of numbers from 1 to n, partition by the predicate function of >> e

File descriptor open in one thread, closed in another?!

2005-02-25 Thread Marco Nicosia
Hello gang, My coworker and I are writing a Python class for the other developers within our team. This class is supposed to encapsulate several things, including daemonizing, setting up logging, and spawning a thread to host an XML-RPC server. I'm having a real problem with logging.Logger and th

Re: Best IDe

2005-02-25 Thread Jarek Zgoda
Jubri Siji napisał(a): Please i am new to python , whats the best IDE to start with Vim, Emacs or jEdit. -- Jarek Zgoda http://jpa.berlios.de/ | http://www.zgodowie.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: exclude binary files from os.walk

2005-02-25 Thread Bengt Richter
On Wed, 26 Jan 2005 18:25:09 -0500, "Dan Perl" <[EMAIL PROTECTED]> wrote: > >"rbt" <[EMAIL PROTECTED]> wrote in message >news:[EMAIL PROTECTED] >> Is there an easy way to exclude binary files (I'm working on Windows XP) >> from the file list returned by os.walk()? >> >> Also, when reading files

Re: Converting HTML to ASCII

2005-02-25 Thread Mike Meyer
Michael Spencer <[EMAIL PROTECTED]> writes: > gf gf wrote: >> [wants to extract ASCII from badly-formed HTML and thinks BeautifulSoup is >> too complex] > > You haven't specified what you mean by "extracting" ASCII, but I'll > assume that you want to start by eliminating html tags and comments, >

fdups: calling for beta testers

2005-02-25 Thread Patrick Useldinger
Hi all, I am looking for beta-testers for fdups. fdups is a program to detect duplicate files on locally mounted filesystems. Files are considered equal if their content is identical, regardless of their filename. Also, fdups ignores symbolic links and is able to detect and ignore hardlinks, whe

Re: Converting HTML to ASCII

2005-02-25 Thread Jorgen Grahn
On Fri, 25 Feb 2005 10:51:47 -0800 (PST), gf gf <[EMAIL PROTECTED]> wrote: > Hans, > > Thanks for the tip. I took a look at Beatiful Soup, > and it looked like it was a framework to parse HTML. This is my understanding, too. > I'm not really interetsed in going through it tag by > tag - just t

Re: unicode encoding usablilty problem

2005-02-25 Thread Vinay Sajip
> This will help in your code, but there is big pile of modules in stdlib > that are not unicode-friendly. From my daily practice come shlex > (tokenizer works only with encoded strings) and logging (you cann't > specify encoding for FileHandler). You can, of course, pass in a stream opened usi

Re: Dealing with config files what's the options

2005-02-25 Thread Jorgen Grahn
On Tue, 22 Feb 2005 20:38:28 -0500, Tom Willis <[EMAIL PROTECTED]> wrote: > How are the expert pythoneers dealing with config files? ... > Any ideas? How about writing them in Python? I have no URL handy, but it would surprise me if there wasn't a lot written about different techniques for doing

  1   2   >