Great Python books for the beginner

2008-01-11 Thread Landon
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.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Great Python books for the beginner

2008-01-12 Thread Landon
One thing I wonder about is the examples these books use to teach the
concepts. I found myself really attached to K&R because the end of
section projects were utilities that I would find be able to find
useful in day to day work such as a version of wc and a program that
would take collapse all consecutive whitespace in a document into one
space. I could just use the projects from K&R, but I imagine a Python
book would have a better selection that highlight Python's abilities.

On another note, I would prefer to have a paper book so I don't have
to keep switching back and forth between documents on my computer.
-- 
http://mail.python.org/mailman/listinfo/python-list


Defining class methods outside of classes

2006-05-03 Thread Lord Landon
Hi, I'm working on a bot written in python. It will consist of a
mostly empty class that will then call a loader which in turn defines
functions and adds them to the class. At the moment, I do this by
using execfile(file,globals()) and calling a load(bot) method defined
in every "module" which takes the functions defined in that perticular
module and does bot.function=function. The problem with that is when I
call bot.function() self doesn't get passed as an argument to the
function. Is there anything I can do to sort this besides calling
bot.function(bot, ...) everytime?

--
Lord Landon rules over all!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: scope of variables

2006-05-03 Thread Lord Landon
Try >>> prnt()
o.o'

On 04 May 2006 08:25:01 +1000, Gary Wessle <[EMAIL PROTECTED]> wrote:
> "Steve R. Hastings" <[EMAIL PROTECTED]> writes:
>
> > On Thu, 04 May 2006 07:02:43 +1000, Gary Wessle wrote:
> > > b = 3
> > > def adding(a)
> > > print a + b
> > >
> > > it seams not to see the up-level scope where b is defined.
> >
> > Assuming you put a ':' after the "def adding(a)", this should work in
> > recent versions of Python.  In Python 2.0 and older, this will not work.
>
> the example was an in-accuretlly representation of a the problem I am
> having. my apologies.
>
> a = []
> def prnt():
>    print len(a)
>
> >>> prnt
> 
>
> I expect to get 0 "the length of list a"
> --
> http://mail.python.org/mailman/listinfo/python-list
>


--
Lord Landon rules over all!
-- 
http://mail.python.org/mailman/listinfo/python-list