Re: Great Python books for the beginner

2008-01-13 Thread MooJoo
In article <[EMAIL PROTECTED]>,
 GeneralCody <[EMAIL PROTECTED]> wrote:

> On 2008-01-12 08:03:42 +0100, Landon <[EMAIL PROTECTED]> said:
> 
> > Hi, I'm a freshman in college and I'm going to be taking an intro to
> > programming course next semester which mainly uses Python, so I
> > thought it might be a good time to pick up Python beyond the scope of
> > the class as well. The text book for this class is Python for the
> > Absolute Beginner or something similar to that name.
> > 
> > I was wondering if anyone had any opinions on what other titles I
> > could look into since this one seems from a glance at reviews to be
> > teaching mainly through game programming (a topic I'm not too
> > interested in) or if this one is a quality book by itself.
> 
> I would definetly go for Learning Python first, maybe Apress "Python, 
> from novice to Professional" as well...
> 
>  

Second those suggestions. Both are excellent books for the novice with 
details more experienced pythonistas can use. Although it is an 
excellent book, stay away from the Python Cookbook for now. Appreciating 
it requires a good working knowledge first.

If you do get Learning Python, make sure its the 3rd edition that just 
became available. It covers the current 2.5 release.
-- 
http://mail.python.org/mailman/listinfo/python-list


Threading the Python interpreter

2008-02-18 Thread MooJoo
I've read that the Python interpreter is not thread-safe but are there 
any issues in creating threads that create new processes (not threads) 
that run new instantiations of python? What I'm doing is subclassing the 
threading.Thread and, in the run method, I'm making a call to os.system, 
passing to it another python script which then processes a file. When 
the call to os.system completes, the thread is finished. Here is a 
simplified fragment of code for what I'm doing.

from threading import Thread
import os

class MyThread(Thread):
   def __init__(self, fn):
  Thread.__init__(self)
  self.fn = fn

   def run(self):
  pyscript = '/usr/bin/env python script.py %s'%self.fn
  status = os.system(pyscript)

thr = MyThread('test.dat')
thr.start()
thr.join()

Since I'm running each python instance in a new process, I don't believe 
that there is a problem and, in my testing so far, I haven't encountered 
anything that would lead me to believe there is a potential time bomb 
here. Am I correct in my assumption this is OK or just lucky so far?
-- 
http://mail.python.org/mailman/listinfo/python-list


Prettyprinting SQL statements

2008-05-10 Thread MooJoo
I'm building a Python app that will be making queries to a MySQL server 
using the MySQLdb module. The app will need to create SQL statements on 
the fly which, in addition to going to the server, will occasionally 
need to be displayed to the user. While these queries are not too 
complex, they still can be difficult to decipher without doing some 
formatting. I've done the requisite Googling to see if a library to 
format SQL can be found but, other than commericial Windows apps and 
some on-line formatters, I've not found anything remotely usable. Before 
trying to write my own parser/formatter, I was hoping somebody might 
know of a package to perform this function.

Anybody? Ferris? Anybody at all?

Thanks.
--
http://mail.python.org/mailman/listinfo/python-list