Re: [Tutor] How would python messure up in performance?

2005-01-23 Thread Chad Crabtree
Kevin wrote: >Thanks for the advise. I am no ware near ready to do this as i am just > >learning to use python. I just thought it would be interesting to see > >a mud made in python rather then always in C or C++. So for now I am > >only going to start out making small programs to learn with. So t

Re: [Tutor] Combination

2005-01-23 Thread Guillermo Fernandez Castellanos
Got it. import copy def rec(list,length): result=[] if len(list)<=length: return [list] for elem in list: temp=copy.deepcopy(list) temp.remove(elem) temp=rec(temp,length) for i in temp:

Re: [Tutor] How would python messure up in performance?

2005-01-23 Thread Kevin
Thanks for the advise. I am no ware near ready to do this as i am just learning to use python. I just thought it would be interesting to see a mud made in python rather then always in C or C++. So for now I am only going to start out making small programs to learn with. So thanks for answering the

Re: [Tutor] How would python messure up in performance?

2005-01-23 Thread Max Noel
On Jan 23, 2005, at 23:57, Kevin wrote: Well not sure how to answer that but I will try. For file I/O you would have a seperat file for each character that would store HP/MANA/MOVE points, store items that the character would have on. Areas would be loaded from there own files with all the creature

Re: [Tutor] How would python messure up in performance?

2005-01-23 Thread Kevin
Well not sure how to answer that but I will try. For file I/O you would have a seperat file for each character that would store HP/MANA/MOVE points, store items that the character would have on. Areas would be loaded from there own files with all the creatures and items for that area in the same fi

[Tutor] Re: Print record x in a file

2005-01-23 Thread Kent Johnson
David Holland wrote: Kent, I know that you know far more about python than me but is that right ? I created file with 4 records and this code did print them all randomly:- import random i = 0 while i < 10: file = open('filename') listcontents = file.readlines() file.close() lenoflis

Re: [Tutor] Print record x in a file

2005-01-23 Thread Kent Johnson
Max Noel wrote: On Jan 23, 2005, at 22:08, Liam Clarke wrote: Don't you mean x=random.randint(0, lenoflist) ?? I'm assuming you want an integer. random.randrange() returns an item (which can be a float or whatever, but by default is an int) in the specified range. In that case, an int betwee

Re: [Tutor] How would python messure up in performance?

2005-01-23 Thread Alan Gauld
> How well would a multi user texed based game created in just Python > run if there were over 300 - 400 players (Just a hypathetical > question) Would python be to slow to handle that amount of traffic? That depends entirely on how it was designed and what kind of hardware you ran it on. If you

Re: [Tutor] Print record x in a file

2005-01-23 Thread Max Noel
On Jan 23, 2005, at 22:08, Liam Clarke wrote: Don't you mean x=random.randint(0, lenoflist) ?? I'm assuming you want an integer. random.randrange() returns an item (which can be a float or whatever, but by default is an int) in the specified range. In that case, an int between 0 and lenoflist.

Re: [Tutor] Print record x in a file

2005-01-23 Thread Liam Clarke
Don't you mean x=random.randint(0, lenoflist) ?? I'm assuming you want an integer. On Sun, 23 Jan 2005 21:55:27 + (GMT), David Holland <[EMAIL PROTECTED]> wrote: > --- [EMAIL PROTECTED] wrote: > > Send Tutor mailing list submissions to > > tutor@python.org > > > > To subscribe or unsubscr

[Tutor] Print record x in a file

2005-01-23 Thread David Holland
--- [EMAIL PROTECTED] wrote: > Send Tutor mailing list submissions to > tutor@python.org > > To subscribe or unsubscribe via the World Wide Web, > visit > http://mail.python.org/mailman/listinfo/tutor > or, via email, send a message with subject or body > 'help' to > [EMAIL PROTECTED] > > Yo

Re: [Tutor] Changing (Unix) environment for python shell/popen() commands

2005-01-23 Thread Danny Yoo
On Sun, 23 Jan 2005, Scott W wrote: > I've got to shell out from my python code to execute a command, but > _must_ set the environment at the same time (or prior to execution). > > I saw some comments about setting os.environ[], but > didn't seem to be seeing this work in subsequent calls using

Re: [Tutor] Changing (Unix) environment for python shell/popen() commands

2005-01-23 Thread "Jörg Wölke"
> Hey all. Hello! > I'm unfortunately stuck using python 1.5.2, primarily on Linux > currently, and have done the usual searching (on list, active state, > google), without luck. > > I've got to shell out from my python code to execute a command, but > _must_ set the environment at the same

[Tutor] Changing (Unix) environment for python shell/popen() commands

2005-01-23 Thread Scott W
Hey all. I'm unfortunately stuck using python 1.5.2, primarily on Linux currently, and have done the usual searching (on list, active state, google), without luck. I've got to shell out from my python code to execute a command, but _must_ set the environment at the same time (or prior to execut

Re: [Tutor] on the way to find pi

2005-01-23 Thread Orri Ganel
Ali Polatel wrote: dear friends , I found a code which calculates pi with an interesting algorithm the programme code is below: from sys import stdout def f((q,r,t,k)):     n = (3*q+r) / t     if (4*q+r) / t == n:     return (10*q,10*(r-n*t),t,k,n)     else:     return (q*k, q*

Re: [Tutor] on the way to find pi

2005-01-23 Thread Max Noel
This code gives the number in an unusual format like "3.1415'None'" it has a number part and a string part . I want to seperate these from easc other but I couldn't manage. I mean when I try to turn it into string format then try to use things like [:4] or like that they don't work.Any idea ho

[Tutor] on the way to find pi

2005-01-23 Thread Ali Polatel
dear friends , I found a code which calculates pi with an interesting algorithm the programme code is below: from sys import stdout def f((q,r,t,k)):    n = (3*q+r) / t    if (4*q+r) / t == n:    return (10*q,10*(r-n*t),t,k,n)    else:    return (q*k, q*(4*k+2)+r*(2*k+1),t*(2*k+1),k+1) # Ca

Re: [Tutor] Print record x in a file

2005-01-23 Thread David Holland
--- "Jacob S." <[EMAIL PROTECTED]> wrote: > > This will get a random record > > I hope you do not think the comments are > patronising > > but you did say you are new so I did not want to > give > > naked code. > > > > import random > > #the above gives the program the ability to get a > > #pseud

Re: [Tutor] How would python messure up in performance?

2005-01-23 Thread Max Noel
On Jan 23, 2005, at 12:55, Kevin wrote: How well would a multi user texed based game created in just Python run if there were over 300 - 400 players (Just a hypathetical question) Would python be to slow to handle that amount of traffic? It depends... What would be happening in said game? What wou

[Tutor] How would python messure up in performance?

2005-01-23 Thread Kevin
How well would a multi user texed based game created in just Python run if there were over 300 - 400 players (Just a hypathetical question) Would python be to slow to handle that amount of traffic? Thanks Kevin ___ Tutor maillist - Tutor@python.org ht

Re: [Tutor] Print record x in a file

2005-01-23 Thread Kent Johnson
Jacob S. wrote: import random #the above gives the program the ability to get a #pseudo random number file = open('test.rantxt') listcontents = file.readlines() #gives you the file as a list of records or it did on #(assuming each line is a record) file.close() lenoflist = len(listcontents)-1 #find