Re: [Tutor] Placing entire Application inside a class

2007-12-19 Thread Alan Gauld
"Jim Morcombe" <[EMAIL PROTECTED]> wrote > In it, Dakota recomends placing the entire application within a > class. > Why is this so? Surely in many cases you end up with a constructor > for the class that is cumbersome and complex? This is a very common OOP technique, especially in languages w

[Tutor] Condensed python2.5 cheat sheet

2007-12-19 Thread Samm and Andy
Hi people, I've a competent programmer friend who I'm trying to convert to the ways of python and I was wondering if people could recommend a decent cheat sheet for python 2.5. He know how to program but just needs the syntax to become pythonic Thanks Andy

Re: [Tutor] Placing entire Application inside a class

2007-12-19 Thread Kent Johnson
Jim Morcombe wrote: > I have just read through "Creating a GUI in Python - by Dakota Lemaster" > > In it, Dakota recomends placing the entire application within a class. > > Why is this so? Surely in many cases you end up with a constructor for > the class that is cumbersome and complex? Man

Re: [Tutor] Condensed python2.5 cheat sheet

2007-12-19 Thread Kent Johnson
Samm and Andy wrote: > Hi people, > > I've a competent programmer friend who I'm trying to convert to the ways > of python and I was wondering if people could recommend a decent cheat > sheet for python 2.5. > He know how to program but just needs the syntax to become pythonic Maybe one of thes

Re: [Tutor] Condensed python2.5 cheat sheet

2007-12-19 Thread Jeff Johnson
There is an excellent book for programmers from other languages. Dive Into Python. http://www.diveintopython.org/toc/index.html Jeff On Wed, 2007-12-19 at 10:08 +, Samm and Andy wrote: > Hi people, > > I've a competent programmer friend who I'm trying to convert to the ways > of python an

Re: [Tutor] Condensed python2.5 cheat sheet

2007-12-19 Thread Alan Gauld
"Samm and Andy" <[EMAIL PROTECTED]> wrote > of python and I was wondering if people could recommend a decent > cheat > sheet for python 2.5. There is a quick reference linked on the Python web site: Here is the URL: http://rgruet.free.fr/PQR25/PQR2.5.html However I'd still recommend an after

[Tutor] Handling MySQLdb exceptions

2007-12-19 Thread Paul Schewietzek
Hi there! I'm writing a script that inserts data from a .csv file into a MySQL-Database. Actually, it works fine (the data make it into the database correctly), however everytime it runs it raises an exception coming from the MySQLdb-module. Here's the code: -

Re: [Tutor] Handling MySQLdb exceptions

2007-12-19 Thread Joshua Simpson
On Dec 19, 2007 10:14 AM, Paul Schewietzek <[EMAIL PROTECTED]> wrote: > > Is there any way to handle this exception? As you can see, I already > tried it with _mysql_exceptions.OperationalError (the lines that are > commented out), but _mysql_exceptions is not defined to Python > > "Operationa

Re: [Tutor] Handling MySQLdb exceptions

2007-12-19 Thread Kent Johnson
Paul Schewietzek wrote: > Just so you don't need to wonder: The .csv-file I give to the script for > testing is absolutely OK. Except that it contains data that the insert statement doesn't like...does it contain any blank lines? Printing 'line' in the exception handler would be useful. Also t

[Tutor] constants, flags or whatever

2007-12-19 Thread Jim Morcombe
In a program, I want to set some kind of variable or object to indicate what "mode" the program is currently in. What is the most elegant way of doing this? Jim --- constant: moving = "m" constant: inserting = "i" constant:ju

Re: [Tutor] constants, flags or whatever

2007-12-19 Thread bhaaluu
This isn't elegant, but it is a start. My method is: get SOMETHING working, then work from there. 8^D """ constant: moving = "m" constant: inserting = "i" constant: jumping = "j" . . action = moving . . . if action == jumping: jumpSomewhere() elseif action == moving: moveSomewhere() elseif

Re: [Tutor] constants, flags or whatever

2007-12-19 Thread bob gailer
Jim Morcombe wrote: > In a program, I want to set some kind of variable or object to > indicate what "mode" the program is currently in. > What is the most elegant way of doing this? > > Jim > --- > constant: moving = "m" >

Re: [Tutor] constants, flags or whatever

2007-12-19 Thread Dave Kuhlman
On Wed, Dec 19, 2007 at 09:41:13PM -0500, bob gailer wrote: > 1 - I see no value in introducing variables. I'd just use string constants: > > action = "moving" > . > . > if action == "jumping": > > etc. I agree. But, some people do prefer something that looks a bit like an enum. If so, here i

Re: [Tutor] constants, flags or whatever

2007-12-19 Thread Steve Willoughby
Dave Kuhlman wrote: > On Wed, Dec 19, 2007 at 09:41:13PM -0500, bob gailer wrote: > >> 1 - I see no value in introducing variables. I'd just use string constants: >> >> action = "moving" >> . >> . >> if action == "jumping": >> >> etc. > > I agree. But, some people do prefer something that looks