Re: [Tutor] question about looping.

2006-10-08 Thread Hugo González Monteverde
Doug Potter wrote: > for i in routers: > os.system('/bin/touch' %s) % i > > of course this dosn't work. > > Is there a simple way to get this done? Yep, someone already answered that you can create the file in write mode and then close it, but I wanted to add a little more in why your sol

Re: [Tutor] byte[] array

2006-10-08 Thread Hugo González Monteverde
gert wohlgemuth wrote: > As anybody an idea how I can do this in python? I can think of three ways: Strings in Python can contain arbitrary binary values, so they can be used. If they're going to be modified often, you may use a list, or you may use the array module for performance. Are you s

Re: [Tutor] Tkinter and python

2006-10-08 Thread Arun Kumar PG
> python on the command prompt/bash shell the script gets> executed.Hey Dave,Thanks for correcting me. I should read what I am writing before I hit the send button :). It was a stupid mistake.. Appending path to PYTHONPATH will allow us to import the module in some other Python script without req

Re: [Tutor] embedding python

2006-10-08 Thread Luke Paireepinart
max . wrote: > hello i have a myspace and a blog both of wich allow me to input html and i > know a little html not much i can make a page with backround coler a title > words and pictures as well as links > > but i cant find any tutorials on embedding python useing html i found some > that use

[Tutor] embedding python

2006-10-08 Thread max .
hello i have a myspace and a blog both of wich allow me to input html and i know a little html not much i can make a page with backround coler a title words and pictures as well as links but i cant find any tutorials on embedding python useing html i found some that use c++ and i think one that

[Tutor] Fw: pretty_printing

2006-10-08 Thread Alan Gauld
Forwarding to the list for interests sake, mainly for vim users. - Original Message - From: "LandSurveyor" <[EMAIL PROTECTED]> Sent: Monday, October 09, 2006 12:00 AM Subject: Re: pretty_printing > This issue has been solved! in a big way!! > (I hope I'm doing this right, replying to y

Re: [Tutor] Can my code be optimized any further (speed-wise)?

2006-10-08 Thread Geoframer
Thanks everyone for the valuable suggestions. Lots of suggestions which i'm sure will improve the speed and performance of my solution. It is indeed the problem Tim said, and it helps a lot to get some help from one of the fastest people on there ;-). I just find it's more fun (and probably more pr

Re: [Tutor] Variable help

2006-10-08 Thread Kent Johnson
Tom R. wrote: > Alternately, how can I use the return of a function as a variables name? eg: > > def choose_player(player): > if player == 1: > return player1[3 > if player == 2: > return player2[3] > if player == 3: > return player3[3] > if player == 4: >

Re: [Tutor] Can my code be optimized any further (speed-wise)?

2006-10-08 Thread Tim Peters
[Geoframer] > The last few days i've been learning python and have been doing this by > trying to solve problems for a programming competition. I assume you're talking about: http://www.spoj.pl/problems/FCTRL/ If so, you'll note that I'm tied for the fastest Python solution there ;-) The /g

Re: [Tutor] Variable help

2006-10-08 Thread Python
On Sun, 2006-10-08 at 10:40 -0300, Ismael Garrido wrote: > Tom R. escribió: > > I have a number of arrays: > > > > player1 = [data, data, data] > > player2 = [data, data, data] > > player3 = [data, data, data] > > player4 = [data, data, data] > > > > I want to be able to do something like: > > > >

Re: [Tutor] Shell Output Format - [was: Is there Python code for accessing an object's reference count?]

2006-10-08 Thread Kent Johnson
Ilias Lazaridis wrote: > how to you get this output format of the shell? > > In [2]: > Out[2]: IPython http://ipython.scipy.org/ Kent ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Can my code be optimized any further (speed-wise)?

2006-10-08 Thread Alan Gauld
I've had a look at the other comments, particularly Kents, but I'll add a few more comments: > One particular problem is bugging me. I have already solved it but > my > solution does not compute in the set time-condition. How can you tell since you pause for user input in the middle of the loop?

[Tutor] Shell Output Format - [was: Is there Python code for accessing an object's reference count?]

2006-10-08 Thread Ilias Lazaridis
Kent Johnson wrote: ... > In [2]: sys.getrefcount(100) > Out[2]: 43 > > In [3]: def foo(): > ...: return 100 > ...: > > In [4]: sys.getrefcount(100) > Out[4]: 44 off-topic: how to you get this output format of the shell? In [2]: Out[2]: I've tried to alter IDLE: IDLE - Customizin

Re: [Tutor] Can my code be optimized any further (speed-wise)?

2006-10-08 Thread Danny Yoo
> You really aren't doing much so there's not a lot to optimize that I can > see. You could try asking on comp.lang.python, lots of people there are > good at optimization. ** spoiler space: don't read ahead here unless you've attempted this problem already, or if you don't want to be spoiled

Re: [Tutor] Tkinter and python

2006-10-08 Thread Dave Kuhlman
On Sun, Oct 08, 2006 at 08:36:31PM +0530, Arun Kumar PG wrote: > Hi, > > You can try: > > >>import sys > >>sys.path.append('') > >>import > > Or else you can append the path to global PYTHONPATH environment variable > and whenever you will type: > > python on the command prompt/bash shell the

Re: [Tutor] Isolation of code

2006-10-08 Thread Dave Kuhlman
On Sun, Oct 08, 2006 at 12:36:32PM +0530, Noufal Ibrahim wrote: > Greetings everyone, >I'm working on a little project that's similar to tcltutor for python. > I have a string which has some python code. I "compile" and "eval" this > to get the output. So far so good. However, when this happens

Re: [Tutor] Tkinter and python

2006-10-08 Thread Noufal Ibrahim
max . wrote: > first off i just started looking for Tkinter tutorials but havent found > much and what i have found was not very good if anyone knows og any > Tkinter tutorials pleas let me know Try this for a good tutorial http://www.pythonware.com/library/tkinter/introduction/ Peace. _

Re: [Tutor] Tkinter and python

2006-10-08 Thread Arun Kumar PG
Hi,You can try:>> import sys>> sys.path.append('')>> import Or else you can append the path to global PYTHONPATH environment variable and whenever you will type: python on the command prompt/bash shell the script gets executed.Hope that helps.Thanks,- Arun On 10/8/06, max . <[EMAIL PROTECTED]> wro

[Tutor] Tkinter and python

2006-10-08 Thread max .
first off i just started looking for Tkinter tutorials but havent found much and what i have found was not very good if anyone knows og any Tkinter tutorials pleas let me know second is thair anyway to change the path that python looks for a program in ex: if i enter python hello into the comm

Re: [Tutor] Python, wxPython a databázová aplik ace

2006-10-08 Thread Pavel Kosina
superman napsal(a): > Dobrý den, > > mohli byste mě nějak nakopnout v tom, jak se dělá databázová aplikace v > Pythonu s použitím wxPython? Respektive jestli wxPython má nějaké prvky, > které slouží přímo pro práci s databázemi, a nebo jestli je potřeba to > udělat ručně a všechno si ošetřit sám

Re: [Tutor] Python, wxPython a databázová aplik ace

2006-10-08 Thread Pavel Kosina
Sorry for this mail, was sent by error. Pavel Kosina superman napsal(a): > Dobrý den, > > mohli byste mě nějak nakopnout v tom, jak se dělá databázová aplikace v > Pythonu s použitím wxPython? Respektive jestli wxPython má nějaké prvky, > které slouží přímo pro práci s databázemi, a nebo jestl

Re: [Tutor] Can my code be optimized any further (speed-wise)?

2006-10-08 Thread Kent Johnson
Geoframer wrote: > Hi everyone, > > The problem is to compute the number of trailing zero's in factorials > (n! = 1*2*3*4*...*n). with n <= 10 > > My solution is as follows (a = times to read a number (b) to process) : > >

Re: [Tutor] Variable help

2006-10-08 Thread Ismael Garrido
Tom R. escribió: > I have a number of arrays: > > player1 = [data, data, data] > player2 = [data, data, data] > player3 = [data, data, data] > player4 = [data, data, data] > > I want to be able to do something like: > > count = 2 > if player + count[3] == 5: >do this >do that >

Re: [Tutor] Can my code be optimized any further (speed-wise)?

2006-10-08 Thread Andre Engels
2006/10/7, Geoframer <[EMAIL PROTECTED]>: > Hi everyone, > > The last few days i've been learning python and have been doing this by > trying to solve problems for a programming competition. > One particular problem is bugging me. I have already solved it but my > solution does not compute in the s

[Tutor] Variable help

2006-10-08 Thread Tom R.
I have a number of arrays: player1 = [data, data, data] player2 = [data, data, data] player3 = [data, data, data] player4 = [data, data, data] I want to be able to do something like: count = 2 if player + count[3] == 5: do this do that count += 1 And that would do this and t

Re: [Tutor] Can my code be optimized any further (speed-wise)?

2006-10-08 Thread Alan Gauld
Thanks, thats a lot clearer. > a = the number of times i'm going to read input to evaluate > lst = the factors of 5. I.e. (5, 5^2, 5^3, 5^4 etc) until the > last one > wich is smaller then 10 OK, I had assumed it was a list of sample factorial results. Not reading it carefully enough

[Tutor] Isolation of code

2006-10-08 Thread Noufal Ibrahim
Greetings everyone, I'm working on a little project that's similar to tcltutor for python. I have a string which has some python code. I "compile" and "eval" this to get the output. So far so good. However, when this happens, the evaluation is happening in the current namespace so I'm afraid of

[Tutor] Isolation of code

2006-10-08 Thread Noufal Ibrahim
Greetings everyone, I'm working on a little project that's similar to tcltutor for python. I have a string which has some python code. I "compile" and "eval" this to get the output. So far so good. However, when this happens, the evaluation is happening in the current namespace so I'm afraid of