Re: [Tutor] SOAPPy - server and threading?

2005-04-23 Thread Kent Johnson
Kristian Rink wrote: HAt the moment, I am trying to implement a small client/server system that communicate using SOAP, and for each client to connect to the SOAP server (via HTTP) I wanted to run a thread which exclusively is responsible to serve that very client. My problem is: Currently I cre

Re: [Tutor] iterator question for a toy class

2005-04-23 Thread Rich Krauter
Marcus Goldfish wrote: I'm trying to understand custom iterators in Python, and created the following toy class for sequence comparison, which seems to work: class Foo(object): """A toy class to experiment with __eq__ and __iter__""" def __init__(self, listA, listB): self.head, self.tai

Re: [Tutor] Newbie Question:Regarding Command line Parsing and Run Unix Shell Command

2005-04-23 Thread Max Noel
On Apr 22, 2005, at 21:09, Prasad Kotipalli wrote: Hello evryone I am a newbie to python. I have a makefile which i can compile in UNIX/LINUX, But i I am planning to write a python script which actually does what my MAKEFILE does. Then what you want is SCons (http://www.scons.org/). Haven't h

[Tutor] Re: [Pythonmac-SIG] Re: Weird import problem with PythonIDE on Mac (was 'import problem')

2005-04-23 Thread Just van Rossum
Jack Jansen wrote: > As always, reading the source provides the answer. > > If you look in PyEdit.py, method Editor.execstring(), you'll see that > the only thing "run as __main__" does is set the module name to > "__main__". It does *not* change the globals dictionary to __main__. > > I'm not

Re: [Tutor] CLS? (Joseph Quigley)

2005-04-23 Thread Alan Gauld
> In QBASIC there was the command "CLS" > this wiped the screen and "started printing letters to the screen at the > top " of the console window. This was possible because QBASIC knew what kind of screen it was working with, Python can't tell that reliably since it runs on many operating systems.

Re: [Tutor] Building application namespaces.

2005-04-23 Thread David Driver
In the root script I import Common. Inside of Common's __init__.py I import the basic domain modules. Is this correct? >If I understand the setup correctly it should work. How are you importing Common? If you say >import Common >you should be able to refer to Common.sobjs. If you say >from Common

[Tutor] Tracking URL in browser location bar

2005-04-23 Thread Gautam Saha
Hi: A newbie here..I was wondering if python can help me to track the URL in browser (IE6+, FF, Mozilla) location bar. What I want is to get each URL from the the browser location bar, as user clicks from links to link in the web (or types an URL) and store it in a flat file and flag some how t

Re: [Tutor] incomprehension in type of classes.

2005-04-23 Thread Cedric BRINER
> >from (I): > > > >class CYear: > > def __init__(self, year): > > self.__year=year > > print str(self.__year) <<---(*) > > print 'dir of: '+str(dir(self)) > > print 'type of: '+str(type(self)) > > def __str__(self): > > return "we are in "+str(self.year) >

Re: [Tutor] iterator question for a toy class

2005-04-23 Thread Kent Johnson
Rich Krauter wrote: 2) Or, if you really want your __eq__ method to use the iterator returned by __iter__(), def __eq__(self, other): for i, j in map(None,self, other): if i != j: return False return True That's not right either, it will compare Foo([None], []) == Foo(

Re: [Tutor] incomprehension in type of classes.

2005-04-23 Thread Kent Johnson
Cedric BRINER wrote: I'm not sure *why* there is this difference between the two types of classes, but there is... ah... I din't know that there was two kinds of classes. So you mean that, now the new style object should be like: class A(object): pass Yes, this is the recommended way to define

Re: [Tutor] SOAPPy - server and threading?

2005-04-23 Thread Kristian Rink
Hi Kent; On Fri, 22 Apr 2005 10:53:52 -0400 Kent Johnson <[EMAIL PROTECTED]> wrote: > If you want each request to be handled in its own thread, use > ThreadingSOAPServer instead of SOAPServer. If you want to dedicate a > thread to each client, I think you will have to run multiple Thanks for po

[Tutor] Help with this script

2005-04-23 Thread John Carmona
Hi guys, I am back from my hols. Jacob S gave me this little exercise to do a little while ago. 1) Make a program to compute the areas of several figures. Make it display a menu on startup, ask for a choice, and then compute the area of the figure chosen by asking for dimensions. 2) Make

Re: [Tutor] SOAPPy - server and threading?

2005-04-23 Thread Kent Johnson
Kristian Rink wrote: Hi Kent; On Fri, 22 Apr 2005 10:53:52 -0400 Kent Johnson <[EMAIL PROTECTED]> wrote: If you want each request to be handled in its own thread, use ThreadingSOAPServer instead of SOAPServer. If you want to dedicate a thread to each client, I think you will have to run multiple

Re: [Tutor] Help with this script

2005-04-23 Thread Kent Johnson
John Carmona wrote: I have decided to merge the 2 scripts. First I should have a menu asking me if I want to compute areas or volumes. Then depending on the choice it should display the relevant menu. My first menu comes on but if I select "b" or "c" the script does not run. The error message po

Re: [Tutor] iterator question for a toy class

2005-04-23 Thread Rich Krauter
Kent Johnson wrote: Rich Krauter wrote: 2) Or, if you really want your __eq__ method to use the iterator returned by __iter__(), def __eq__(self, other): for i, j in map(None,self, other): if i != j: return False return True That's not right either, it will compare Fo

[Tutor] Re Help with this script

2005-04-23 Thread John Carmona
Thanks Kent, it is working now. Is this what you meant in your reply? Because if I set up the main code at the end of the script I was still getting an error message. Also, what do I need to use if for example I want my code to rerun once I have computed let's say a volume. Right now the execut

Re: [Tutor] Re Help with this script

2005-04-23 Thread Max Noel
On Apr 23, 2005, at 15:44, John Carmona wrote: Thanks Kent, it is working now. Is this what you meant in your reply? Because if I set up the main code at the end of the script I was still getting an error message. Also, what do I need to use if for example I want my code to rerun once I have co

Re: [Tutor] Re Help with this script

2005-04-23 Thread Kent Johnson
John Carmona wrote: Thanks Kent, it is working now. Is this what you meant in your reply? Because if I set up the main code at the end of the script I was still getting an error message. Yes, that's what I meant, though you just need task_options() rather than print task_options() When you say pr

[Tutor] Python and Web Pages?

2005-04-23 Thread Paul Tader
I have a couple programs/scripts that I want to write that need to be web-based. Can Python (and a little HTML) accomplish this? Or are other languages like PHP, or Perl better suited? A little more detail: One project is to make a web page that users login to with a name and password, choose

Re: [Tutor] Python and Web Pages?

2005-04-23 Thread Kent Johnson
Paul Tader wrote: I have a couple programs/scripts that I want to write that need to be web-based. Can Python (and a little HTML) accomplish this? Or are other languages like PHP, or Perl better suited? Yes, Python can do this nicely. You can write CGI programs in Python or use one of the many

Re: [Tutor] Python and Web Pages?

2005-04-23 Thread Jay Loden
I use both Python and PHP on my website to do a variety of tasks. Some things PHP can do much easier than Python, but if you're doing simple things like form handling, Python will do nicely. If you're comfortable with Python, use it. I find Python much easier to work with than PHP for a lot

[Tutor] design questions: pythonic approach to ostriches

2005-04-23 Thread Brian van den Broek
Hi all, I am wondering about the Pythonic way to handle the problem of ostriches, emus, and penguins. (I cannot recall from where I got the example.) Here's what I mean: class Bird(object): def fly(self): # flying logic here def lay(self): # egg-laying logic here # mo

Re: [Tutor] iterator question for a toy class

2005-04-23 Thread Marcus Goldfish
> - As Rich pointed out, making Foo into it's own iterator by adding a next() > method is not a good idea. A simple way to define your own iterator is to I see that an iterator is conceptually distinct from the container object it iterates over, but I am confused that both the iterator and containe

Re: [Tutor] design questions: pythonic approach to ostriches

2005-04-23 Thread Kent Johnson
Brian, I think you have done a great job of demonstrating that design has to be evaluated in the light of requirements. There are probably scenarios where each of these solutions makes sense. Without knowing how it is to be used, there is no way to pick the 'right' one. For example in a bird sim

Re: [Tutor] iterator question for a toy class

2005-04-23 Thread Kent Johnson
Sending to the list, originally this went just to Marcus... Marcus Goldfish wrote: I'm trying to understand custom iterators in Python, and created the following toy class for sequence comparison, which seems to work: class Foo(object): """A toy class to experiment with __eq__ and __iter__"""

Re: [Tutor] design questions: pythonic approach to ostriches

2005-04-23 Thread Rich Krauter
Brian van den Broek wrote: Hi all, I am wondering about the Pythonic way to handle the problem of ostriches, emus, and penguins. (I cannot recall from where I got the example.) Here's what I mean: class Bird(object): def fly(self): # flying logic here def lay(self): # egg

Re: [Tutor] iterator question for a toy class

2005-04-23 Thread Kent Johnson
Marcus Goldfish wrote: I see that an iterator is conceptually distinct from the container object it iterates over, but I am confused that both the iterator and container implement __iter__() to support the iterator protocol. I think this is to simplify the Python runtime. 'for i in c' will work if

Re: [Tutor] CLS? (Joseph Quigley)

2005-04-23 Thread Alan Gauld
> Drat. I do like the \n * 100 though but that really wasn't what I was > getting at. Do you know what the command is for Mac The problem is that it depends not just on the OS. MacOS X is Unix and that can support zillions of different terminal types each with their own control codes. These are m

Re: [Tutor] Help with this script

2005-04-23 Thread Alan Gauld
> should display the relevant menu. My first menu comes on but if I select "b" > or "c" the script does not run. The error message points out that > "print_options()" or "print_options_2()" are not defined. Could somebody > point me into the right direction, thanks. Thats because you define them a

Re: [Tutor] design questions: pythonic approach to ostriches

2005-04-23 Thread Alan Gauld
> I am wondering about the Pythonic way to handle the problem of > ostriches, emus, and penguins. (I cannot recall from where I got the > example.) Its not really a Python issue its one of several similar conundrums in OOP in any language. My solution for this one: class Bird()... class Flightl

Re: [Tutor] design questions: pythonic approach to ostriches

2005-04-23 Thread Brian van den Broek
Alan Gauld said unto the world upon 2005-04-23 15:18: I am wondering about the Pythonic way to handle the problem of ostriches, emus, and penguins. (I cannot recall from where I got the example.) Its not really a Python issue its one of several similar conundrums in OOP in any language. Thanks Al

[Tutor] Does Python have anything like Perls format output?

2005-04-23 Thread Tom Tucker
Good evening! Does Python have a print function similar to Perl format output (example below)? Thanks Tom format STDOUT = @< @ @<<< [EMAIL PROTECTED] [EMAIL PROTECTED] $code, $date,$descript,$amt, $balance ___

Re: [Tutor] Does Python have anything like Perls format output?

2005-04-23 Thread Danny Yoo
On Sat, 23 Apr 2005, Tom Tucker wrote: > Good evening! Does Python have a print function similar to Perl > format output (example below)? Hi Tom, Not exactly, but we can get something close, by using the String Formatting operators. http://www.python.org/doc/current/lib/typesseq-strings.

Re: [Tutor] design questions: pythonic approach to ostriches

2005-04-23 Thread Danny Yoo
> I do remain a bit surprised that there seems to be no way to implement > what I naively thought would be the obvious solution -- to remove an > inherited method from the instance's dictionary. Hi Brian, If we're trying to do this, we probably don't want to "inherit" from a parent. A subclas

[Tutor] Bandwidth Tester

2005-04-23 Thread Ali Polatel
Hi Tutors, How can i write a simple bandwidth tester with Python? Regards, ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] design questions: pythonic approach to ostriches

2005-04-23 Thread Brian van den Broek
Danny Yoo said unto the world upon 2005-04-23 22:16: I do remain a bit surprised that there seems to be no way to implement what I naively thought would be the obvious solution -- to remove an inherited method from the instance's dictionary. Hi Brian, If we're trying to do this, we probably don't