Re: [Tutor] YATENJoe

2005-05-17 Thread Andrei
Joseph Quigley gmail.com> writes: > Is there a way of telling Python to make a new line after you press Enter (return)? Return automatically ends the current input line (and therefore starts a new one) when you use raw_input. >> I would suggest that you learn a bit more about Python's facilitie

[Tutor] help me on python + snack

2005-05-17 Thread Mahmad Sadique Hannure
Hello friends, I m currently working on sound stuff. I have installed all stuff related to Snack. My code for playing mp3 song is like this #!/usr/bin/python2.3 from Tkinter import * import tkSnack def main(): root = Tk() tkSnack.initializeSnack(root) mysound = tkSnack.So

[Tutor] game instructions

2005-05-17 Thread EUGENE ASTLEY
Following the Tutorial by Michael Dawson and the previous web help from Liam Clark, I have a basic Othello Game up and running quite well. I now want to start the game with a set of instructions that stays on the screen until the user is ready to proceed. Since you are only allowed one scr

Re: [Tutor] using -i flag with '''if __name__ == "__main__":'''

2005-05-17 Thread Kent Johnson
Terry Carroll wrote: > I've often found it convenient to run a Python program I'm developing with > the -i flag. I find it convenient to use as a post-mortem as it hits bugs, > or to explore data structures. > > I've recently started using the construct > > if __name__ == "__main__": >

Re: [Tutor] Tutor Digest, Vol 15, Issue 40

2005-05-17 Thread Kent Johnson
[EMAIL PROTECTED] wrote: > Quoting Kent Johnson <[EMAIL PROTECTED]>: > > >>J. Gabriel Schenz wrote: >> >>>Now, I am new to Python as well, but it seems like apply might not be >>>completely superfluous. I was thinking that if one were using a functional >>>programming style, and had to apply a fu

Re: [Tutor] hettingertools?

2005-05-17 Thread jfouhy
Quoting Terry Carroll <[EMAIL PROTECTED]>: > On Tue, 17 May 2005, D. Hartley wrote: > > This was a hint from a python challenge, but I can't find anything > > about it online: Anyone know? > Raymond Hettinger is a frequent contributor to Python. I don't know if > that is part of it. If I had to

Re: [Tutor] hettingertools?

2005-05-17 Thread Terry Carroll
On Tue, 17 May 2005, Terry Carroll wrote: > On Tue, 17 May 2005, D. Hartley wrote: > > > This was a hint from a python challenge, but I can't find anything > > about it online: Anyone know? > > Raymond Hettinger is a frequent contributor to Python. I don't know if > that is part of it. And ac

Re: [Tutor] hettingertools?

2005-05-17 Thread Terry Carroll
On Tue, 17 May 2005, D. Hartley wrote: > This was a hint from a python challenge, but I can't find anything > about it online: Anyone know? Raymond Hettinger is a frequent contributor to Python. I don't know if that is part of it. ___ Tutor maillist

Re: [Tutor] using -i flag with '''if __name__ == "__main__":'''

2005-05-17 Thread Terry Carroll
On Wed, 18 May 2005 [EMAIL PROTECTED] wrote: > If main is a class, you could change to 'm = main()'; that would at > least give you access to the class attributes. Interesting approach; I'm refering to where main() is a method, the usual python idiom. __

[Tutor] hettingertools?

2005-05-17 Thread D. Hartley
This was a hint from a python challenge, but I can't find anything about it online: Anyone know? Thanks :) ~Denise ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Tutor Digest, Vol 15, Issue 40

2005-05-17 Thread jfouhy
Quoting Kent Johnson <[EMAIL PROTECTED]>: > J. Gabriel Schenz wrote: > > Now, I am new to Python as well, but it seems like apply might not be > > completely superfluous. I was thinking that if one were using a functional > > programming style, and had to apply a function determined at runtime to

Re: [Tutor] using -i flag with '''if __name__ == "__main__":'''

2005-05-17 Thread jfouhy
Quoting Terry Carroll <[EMAIL PROTECTED]>: > I've recently started using the construct > > if __name__ == "__main__": > main() > > And found I can't do the -i thing effectively any more. What's a good > equivalent approach? If main is a class, you could change to 'm = main()'; that would at

Re: [Tutor] Troubles with Python modules

2005-05-17 Thread Alberto Troiano
Here you go Each filenaem corresponds to the command Thanks in advanced Alberto From: Danny Yoo <[EMAIL PROTECTED]> To: Alberto Troiano <[EMAIL PROTECTED]> CC: tutor@python.org Subject: Re: [Tutor] Troubles with Python modules Date: Tue, 17 May 2005 14:56:52 -0700 (PDT) On Tue, 17 May 2005, Albert

Re: [Tutor] Perl equivalent of $#var

2005-05-17 Thread Danny Yoo
On Tue, 17 May 2005, Smith, Jeff wrote: > Is there a more Pythonic way to get the Perl equivalent of > $#var > other than > len(var) - 1 Hi Jeff, Just out of curiosity, where do you use Perl's $#var? Can you show us the context of its use? If we see context, it might help us fin

Re: [Tutor] Troubles with Python modules

2005-05-17 Thread Danny Yoo
On Tue, 17 May 2005, Alberto Troiano wrote: > Sorry about the question marks (MSN addiction :)) > > Didn't work and as I suspected it was already installed. Hi Alberto, I'm still thinking that the MySQL development packages are either damaged or mixed up, since the error message says that it c

[Tutor] Menu help

2005-05-17 Thread Alberto Troiano
Hey I know I posted so many things but it's because I have so much to do I used to program in VB 6 but I want to learn a programming so I can I master it. I want to make a menu (Tkinter) like the one of the image attached to this email I can do the menu and submenu but I can't do the third subme

Re: [Tutor] Perl equivalent of $#var

2005-05-17 Thread Max Noel
On May 17, 2005, at 22:00, Smith, Jeff wrote: > Is there a more Pythonic way to get the Perl equivalent of > $#var > other than > len(var) - 1 AFAIK, len(var) - 1 is the only way. Note, however, that the last element of a list (or of any ordered sequence) can be obtained with th

Re: [Tutor] Troubles with Python modules

2005-05-17 Thread Danny Yoo
On Tue, 17 May 2005, Alberto Troiano wrote: > I'm sending the errors MySQLdb gives me when I try to install it. It's > hola.txt file > I'm doing python setup.py build and inside hola.txt you can see what it says > I have installed Linux Red Hat with ALL packages Hi Alberto, [Side note: please

[Tutor] Perl equivalent of $#var

2005-05-17 Thread Smith, Jeff
Is there a more Pythonic way to get the Perl equivalent of $#var other than len(var) - 1 Thanks, Jeff ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] YATENJoe

2005-05-17 Thread Joseph Quigley
If you intend to make a text editor (something which allows the user to browse through the text and manipulate it at will) using just raw_input and print, I think you've set yourself an impossible task. For a console editor you should probably look at curses (http://www.amk.ca/python/howto/curses

[Tutor] Problem with a while loop.

2005-05-17 Thread . ,
Hi, I'm writing a program that is a program that flips a coin 100 times and then tells the number of heads and tails. --- import random head = 0 tail = 0 coin

Re: [Tutor] Troubles with Python modules

2005-05-17 Thread Alberto Troiano
Hey Danny Sorry about the question marks (MSN addiction :)) Didn't work and as I suspected it was already installed. What else can I do? Is there another built-in module that resemble datetime module? I had to use Python 2.2.2 because of MySQLdb but now I can't use datetime. As you see I'm in

Re: [Tutor] Problem with a while loop.

2005-05-17 Thread Goldie, Josh
import random head = 0 tail = 0 while (head + tail) < 100: coin = random.randrange(2) <-- move this line inside the loop if coin == 0: -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of . , Sent: Tuesday, May 17, 2005 4:12 PM To: tutor@python.or

Re: [Tutor] Troubles with Python modules

2005-05-17 Thread Alberto Troiano
First of all, thanks for the corrections I'm assuming that Python 2.2 doesn't have datetime module then??? Is there any way to install it??? My version of Python 2.3.4 is an alternative installation so I know that when I type python with my root account its going to Python 2.2.2 (I'm using

Re: [Tutor] I know you will hate this but...

2005-05-17 Thread Kent Johnson
Smith, Jeff wrote: > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On > Behalf Of Andrei >>Weird. Looks to me like the wrong solution (it would IMO be better to find >>out >>who committed the broken code and work from there to find the cause), but >>whatever works for you. > > > I agree

Re: [Tutor] I know you will hate this but...

2005-05-17 Thread Smith, Jeff
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Andrei >It seems problematic to me to NOT enforce standard *settings* (e.g. 4 spaces >per indentation level, no tabs). Any IDE can be used as long as the proper >settings are configured. Inconsistent indentation styles are very an

[Tutor] using -i flag with '''if __name__ == "__main__":'''

2005-05-17 Thread Terry Carroll
I've often found it convenient to run a Python program I'm developing with the -i flag. I find it convenient to use as a post-mortem as it hits bugs, or to explore data structures. I've recently started using the construct if __name__ == "__main__": main() And found I can't do the -i

Re: [Tutor] I know you will hate this but...

2005-05-17 Thread Andrei
Smith, Jeff medplus.com> writes: > merge...that doesn't really matter. It seems problematic to me to try > to enforce tool standards on people (IDE and editor settings) which may > or may not take. It seems problematic to me to NOT enforce standard *settings* (e.g. 4 spaces per

Re: [Tutor] Troubles with Python modules

2005-05-17 Thread Danny Yoo
On Tue, 17 May 2005, Alberto Troiano wrote: > I'm working on Python 2.2 over Linux REd Hat 9.0 and here is the code I > have [code cut] > First I'd like to know if this code can be shorter or more efficient (if > you have the time) Yes. But let's look at the errors first. > Second the err

Re: [Tutor] Lists of files

2005-05-17 Thread Karl Pflästerer
On 16 Mai 2005, [EMAIL PROTECTED] wrote: > Thanks to all who helped me with my questions regarding testing for > commandline arguments and list assignment. I have finished my first > Python program (included below). It is slightly more secure than the > Perl program I rewrote, but also about a t

Re: [Tutor] Objects in List (fwd)

2005-05-17 Thread Danny Yoo
> Hi Danny > > Thanks, it works - I must read the documentation more carefully! > > Would you mind if I knok on your door again with futher Python hick-ups? Hi Danie, It's probably a better idea to send your questions to Tutor. The reason is to allow the community to get involved. Also, I have

Re: [Tutor] Removing lines in string-table

2005-05-17 Thread Olli Rajala
My code: > > for line in fileNames: > > if line[-10:] == '_thumb.jpg': > > fileNames.remove(line) Chris wrote: > The above will not work if two successive lines contain the target > text. When you remove the one, its neighbor "slides over" to take the > place of the one removed and the

Re: [Tutor] Removing lines in string-table

2005-05-17 Thread Chris Smith
On Tuesday, May 17, 2005, at 08:35 America/Chicago, [EMAIL PROTECTED] wrote: > I have a string table (don't recall the right word used in Python > right now) and would like to remove every 'cell' that contains a > string '_thumb.jpg'. There are 1-> digits before the string if that > matters. I m

[Tutor] Use Strict or Use Warnings was ( Lists of files)

2005-05-17 Thread Mike Hansen
> > > Subject: > Re: [Tutor] Lists of files > From: > William O'Higgins <[EMAIL PROTECTED]> > Date: > Mon, 16 May 2005 15:50:37 -0400 > > [...] > > One last thing - is there an equivalent of the "use strict" and "use > war

Re: [Tutor] Removing lines in string-table

2005-05-17 Thread Olli Rajala
> Looks like a job for a list comprehension: > > fileNames = [element for element in fileNames if not element.endswith > ("_thumb.jpg")] Thanks Max! It seem to work, but now I have to do some reading, because I have no idea why it works or what it really does. :) But thanks anyway. Yours,

Re: [Tutor] Removing lines in string-table

2005-05-17 Thread Max Noel
On May 17, 2005, at 08:52, Olli Rajala wrote: > Okay, > I have a string table (don't recall the right word used in Python > right now) It's called a list, or an array. > and would like to remove every 'cell' that contains a > string '_thumb.jpg'. There are 1-> digits before the string if t

[Tutor] Troubles with Python modules

2005-05-17 Thread Alberto Troiano
Hey I'm working on Python 2.2 over Linux REd Hat 9.0 and here is the code I have import os import sys import MySQLdb import datetime import time class conexion(object): def __init__(self): self.db = MySQLdb.connect(host="localhost", user="administrador", passwd="123456",db="segurida

[Tutor] I know you will hate this but...

2005-05-17 Thread Smith, Jeff
I'm working on a Python development project which spans multiple people. We are all working on Windows and using the PyWin IDE. Our code is revision controlled using Perforce. Already we had one instance where the logical structure of a file was destroyed because indentation levels were changed a

[Tutor] Python Interest Group in New England

2005-05-17 Thread Lloyd Kvam
(From digest) > I'm aware of the Boston PIG, a smaller one in Amherst and have been > told that there is possibly a PIG in Manchester, NH. The Dartmouth Lake Sunapee Linux User Group http://dlslug.org/ also supports a python mail list. http://dlslug.org/mailing_lists.html The P

Re: [Tutor] Tkinter questions

2005-05-17 Thread Alberto Troiano
Thanks for the reply I read the link and I think I've got all what I need (at least for now) Thanks again Regards Alberto >From: [EMAIL PROTECTED] >To: Tutor Tutor >Subject: Re: [Tutor] Tkinter questions >Date: Tue, 17 May 2005 11:03:45 +1200 (NZST) > >Quoting Alberto Troiano <[EMAIL PROTECTE

Re: [Tutor] Tutor Digest, Vol 15, Issue 40

2005-05-17 Thread Kent Johnson
J. Gabriel Schenz wrote: > Now, I am new to Python as well, but it seems like apply might not be > completely superfluous. I was thinking that if one were using a functional > programming style, and had to apply a function determined at runtime to an > argument, then one could use this apply to do

Re: [Tutor] Opinions about this GIS script

2005-05-17 Thread Ron Phillips
Thank you, Andrei, that's just what I was hoping for -- I wondered about some of those issues, but was a little unsure how to approach a solution.   Ron     ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Tutor Digest, Vol 15, Issue 40

2005-05-17 Thread J. Gabriel Schenz
>At 02:17 PM 5/12/2005, Bernard Lebel wrote: >>Just a generic question: why one would use apply()? >> >>In Learning Python, on page 357, there is an example of generating an >>instance using apply(): >> >>class A: >> def __init__( self, number ): >> self.number = number >> >>a =

Re: [Tutor] Python Interest Group Query

2005-05-17 Thread Kent Johnson
Lee Cullens wrote: > Python Interest Group Query > > I'm aware of the Boston PIG, a smaller one in Amherst and have been > told that there is possibly a PIG in Manchester, NH. > > Basically I'm trying to find out if there are any, or any interest in > (or even any other Python users at all :~

Re: [Tutor] Testing for commandline args

2005-05-17 Thread Cedric BRINER
> Also, I hear that optparse is much better than getopt. this is a true pleasure to work with optparse. It was included in python2.3 and was primarly called python-optik Ced. -- Cedric BRINER ___ Tutor maillist - Tutor@python.org http://mail.py

Re: [Tutor] creation of a module

2005-05-17 Thread Cedric BRINER
Hi Alan > Hi Cedric, > > Reading through this I can't help but think you are going to > a lot of trouble to make things very complicated for yourself > - and for anyone else who has to work on your code. The > Python module system is very simple and helpful in tracking > down where the various thi

[Tutor] Removing lines in string-table

2005-05-17 Thread Olli Rajala
Okay, I have a string table (don't recall the right word used in Python right now) and would like to remove every 'cell' that contains a string '_thumb.jpg'. There are 1-> digits before the string if that matters. I made a for-loop that does what I want to: for line in fileNames: if line[-10:]

Re: [Tutor] Opinions about this GIS script

2005-05-17 Thread Andrei
Ron Phillips engineer.co.summit.oh.us> writes: > The script produces expected results, but if anyone is so inclined, I'd appreciate review/evaluation/critique of the 'pythonism' of the script. I haven't read it from A to Z, but it looks OK. Some minor things: - string formatting, e.g.: out+= '

Re: [Tutor] Linux variable to Python

2005-05-17 Thread Terry Carroll
On Fri, 13 May 2005, Alberto Troiano wrote: > To explain for those who doesn't know: > The first line creates a variable named "fec" with the value cam(a Linux > function returning year month day hour minute second).jpg > The second show the value of "fec" > The third moves hola.txt to the direct

[Tutor] Save data 'over SSH'

2005-05-17 Thread Olli Rajala
Hi guys (and gals too!) I'm writing a program where I would need to write the output finally to the computer I can access with SSH/SFTP/SCP. So, is there any 'pythonish' way to do it, or do I have to use os.system() or something similar? I can save it temporarily to the computer the program is run

Re: [Tutor] YATENJoe

2005-05-17 Thread Andrei
Joseph Quigley gmail.com> writes: > I want to make a text editor. I know that there are hundreds out there, > but practice makes perfect, and I need the practice. My problem is > that I have no idea how to make one. I've tried a little already by > defining line functions:def line1():l1 =

Re: [Tutor] help with my python app

2005-05-17 Thread Alan G
Hi James, I can't answer your question because I don't know anything about pygame, but your code would look a lot better if you wrote a function (handleKeyEvent() say?) to avoid repeating all that code. One of the big advantages of using functions - aside from saving typing effort - is that they m