Re: [Tutor] PHP & Python suggestions....

2008-02-03 Thread Alan Gauld
"GTXY20" <[EMAIL PROTECTED]> wrote > Anyway, I am looking for some suggestions for reading up on how to > call > Python from PHP scripts, specifically calling from a PHP web > application - > PHP will call python script with some arguments and python will run > on the > server and return the r

Re: [Tutor] Hello and newbie question about "self"

2008-02-03 Thread Alan Gauld
"Patrick Lists" <[EMAIL PROTECTED]> wrote > I probably won't need to start writing classes but I really want to > finish the book before I start coding something. Such things are personal but I would personally recommend writing as much code as you can as soon as you can. Do the examples in the

Re: [Tutor] Hello and newbie question about "self"

2008-02-03 Thread Kent Johnson
Tony Cappellini wrote: >>> http://www.ibiblio.org/swaroopch/byteofpython/read/self.html > Is there a typo in the contents of this web page? Yes, you are right, C++ uses 'this'. Kent > > Should this statement > > Note for C++/Java/C# Programmers > > The self in Python is equivalent to the "sel

Re: [Tutor] Hello and newbie question about "self"

2008-02-03 Thread Tony Cappellini
>>http://www.ibiblio.org/swaroopch/byteofpython/read/self.html Is there a typo in the contents of this web page? Should this statement Note for C++/Java/C# Programmers The self in Python is equivalent to the "self" pointer in C++ and the this reference in Java and C#. Actually be Note for C++

Re: [Tutor] TypeError

2008-02-03 Thread Kent Johnson
Seon Kang wrote: > class EnemyPokemon(games.Sprite): > > image = games.load_image("bulbasaur.bmp") > > def __init__(self, speed = 2, odds_change = 200, y = 240): > """ Initialize the Chef object. """ > super(EnemyPokemon, self).__init__(image = EnemyPokemon.image, y > = 2

Re: [Tutor] Hello and newbie question about "self"

2008-02-03 Thread Patrick Lists
Hi Alan, Alan Gauld wrote: > "Patrick" <[EMAIL PROTECTED]> wrote > >> Can anyone please point me to a document that explains "self" in >> layman's terms. > > Try the OOP topic inmy tutorial... Thanks will have a look. >> Or lacking such a doc throw in a much appreciated >> layman's explanati

Re: [Tutor] Hello and newbie question about "self"

2008-02-03 Thread Patrick
Hi Alan, Alan Gauld wrote: > "Patrick" <[EMAIL PROTECTED]> wrote > >> Can anyone please point me to a document that explains "self" in >> layman's terms. > > Try the OOP topic inmy tutorial... Thanks will have a look. >> Or lacking such a doc throw in a much appreciated >> layman's explanati

Re: [Tutor] Hello and newbie question about "self"

2008-02-03 Thread Patrick
Hi Michael, Michael Langford wrote: > In C, you may have "objectorientedesque" code like the following; > > struct net { > int foo; > int bar; > int baz; > }; > > > void populate_net( struct net* mynet, int fooval, int barval) > { > mynet->foo = fooval; > mynet->bar = ba

Re: [Tutor] Hello and newbie question about "self"

2008-02-03 Thread Patrick
Hi Kent, Kent Johnson wrote: > Patrick wrote: >> Hi guru's, >> >> New to the list. I bought O'Reilly's Learning Python (3rd edition for >> 2.5) a while back. Slowly making my way through it and was pleasantly >> surprised that Python seems easier than C. Until...I bumped into the >> "self" thingy.

Re: [Tutor] Hello and newbie question about "self"

2008-02-03 Thread Alan Gauld
"Patrick" <[EMAIL PROTECTED]> wrote > Can anyone please point me to a document that explains "self" in > layman's terms. Try the OOP topic inmy tutorial... > Or lacking such a doc throw in a much appreciated > layman's explanation what "self" is and when/where to use it? Others have given co

[Tutor] PHP & Python suggestions....

2008-02-03 Thread GTXY20
Hi all, First off let me say how helpful and informative this mailing list is. It is very much appreciated. Anyway, I am looking for some suggestions for reading up on how to call Python from PHP scripts, specifically calling from a PHP web application - PHP will call python script with some argu

[Tutor] PyCon 2008 Tutorial Sessions

2008-02-03 Thread Greg Lindstrom
Registration for PyCon 2008 is now open. Held in Chicago March 14-16 with "Tutorial Thursday" on March 13 and sprints afterwards, it is expected that nearly 800 Python enthusiasts will attend at least part of the conference. It is totally run by volunteers and is affordable for just about anyone.

Re: [Tutor] TypeError

2008-02-03 Thread Kent Johnson
Seon Kang wrote: > Why does it not specify the type? Actually, it is specifying the type of the bad argument, which is itself 'type'. Confusing, I know. Try this: >>> 1+int Traceback (most recent call last): File "", line 1, in : u

Re: [Tutor] newbie code review please!

2008-02-03 Thread Kent Johnson
Tyler Smith wrote: > iflist = ifstring.replace('\n', ' ').split() The replace is not needed, split() splits on any whitespace including newlines. > # build hash of form (prefix1, prefix2): [word] > word_hash = {} > for i in range(len(iflist) - 2): > pr1 = iflist[i] > pr2 = iflist[i+1] >

Re: [Tutor] Hello and newbie question about "self"

2008-02-03 Thread Kent Johnson
Patrick wrote: > Hi guru's, > > New to the list. I bought O'Reilly's Learning Python (3rd edition for > 2.5) a while back. Slowly making my way through it and was pleasantly > surprised that Python seems easier than C. Until...I bumped into the > "self" thingy. This should be covered by any tutor

Re: [Tutor] TypeError

2008-02-03 Thread Kent Johnson
Seon Kang wrote: > When i tried to run my program, i was given this message > (this is the message in part) > > file "C:Python25\lib\site-packages\livewires\games.py", line 503, in_tick > self.position = ((self._x + self._dx), (self._y + self._dy)) > TypeError: unsopported opernad type(s) for

Re: [Tutor] Bad time to get into Python?

2008-02-03 Thread Kent Johnson
I did a little research on the question of running the same script unmodified in Python 2.6 and 3.0. It seems that there is no consensus opinion and it may depend on your personal tolerance for compatibility cruft. Here is a c.l.py thread of interest: http://groups.google.com/group/comp.lang.pyt

Re: [Tutor] Hello and newbie question about "self"

2008-02-03 Thread Michael Langford
In C, you may have "objectorientedesque" code like the following; struct net { int foo; int bar; int baz; }; void populate_net( struct net* mynet, int fooval, int barval) { mynet->foo = fooval; mynet->bar = barval; mynet ->baz = fooval * 5; } int connect_to_net(str

[Tutor] newbie code review please!

2008-02-03 Thread Tyler Smith
Hi, I'm a middling amateur coder in C and elisp, trying to wrap my head around python syntax. I've implemented the code for the markov chain random text generator from Kernighan and Pike's "The practice of programming", and I'd appreciate any tips on how to make it more pythonic. The code appears

[Tutor] TypeError

2008-02-03 Thread Seon Kang
When i tried to run my program, i was given this message (this is the message in part) file "C:Python25\lib\site-packages\livewires\games.py", line 503, in_tick self.position = ((self._x + self._dx), (self._y + self._dy)) TypeError: unsopported opernad type(s) for +: 'int' and type' What is t

[Tutor] Hello and newbie question about "self"

2008-02-03 Thread Patrick
Hi guru's, New to the list. I bought O'Reilly's Learning Python (3rd edition for 2.5) a while back. Slowly making my way through it and was pleasantly surprised that Python seems easier than C. Until...I bumped into the "self" thingy. Can anyone please point me to a document that explains "self"

Re: [Tutor] Bad time to get into Python?

2008-02-03 Thread Kent Johnson
Dotan Cohen wrote: > Thanks. My concern is not that the code won't run on Python3, rather, > that the effort that I put into learning 2.x will be wasted when 3.x > will be current. No, it will not be wasted. 3.0 is not a new language, it is a major tuneup of the existing language. > Now I'm a b

Re: [Tutor] Bad time to get into Python?

2008-02-03 Thread Dotan Cohen
On 03/02/2008, Kent Johnson <[EMAIL PROTECTED]> wrote: > Dotan Cohen wrote: > > The little programming that I need I have been able to get away with > > silly php and bash scripts. However, my needs are getting bigger and I > > see Python as an ideal language for my console apps, and the > > oc

Re: [Tutor] Bad time to get into Python?

2008-02-03 Thread Kent Johnson
Dotan Cohen wrote: > The little programming that I need I have been able to get away with > silly php and bash scripts. However, my needs are getting bigger and I > see Python as an ideal language for my console apps, and the > occasional GUI that I might write for the wife. However, with the > com

Re: [Tutor] Bad time to get into Python?

2008-02-03 Thread Thomas Pani
Dotan Cohen wrote: > However, with the coming of Python3 and the new syntax, is this a bad time to > start learning Python? Not at all, I'd say. Changes will be fairly small, with the main changes being: - print is replaced by a print() function - / will become the float division operator - cha

Re: [Tutor] os.system() problem

2008-02-03 Thread Michael Langford
motion/motion.conf > [0] Processing config file /etc/motion/motion.1.conf > [0] Processing config file /etc/motion/motion.2.conf > [1] Thread is from /etc/motion/motion.1.conf > [2] Thread is from /etc/motion/motion.2.conf > [1] Thread started > [2] Thread started > [1] File of t

Re: [Tutor] Bad time to get into Python?

2008-02-03 Thread Dotan Cohen
On 03/02/2008, Alan Gauld <[EMAIL PROTECTED]> wrote: > > "Dotan Cohen" <[EMAIL PROTECTED]> wrote > > > coming of Python3 and the new syntax, is this a bad time to start > > learning Python? I don't want to learn 2.x if 3.x will replace it, > > 3.x won't be the end of changes in Python, amy more tha

[Tutor] os.system() problem

2008-02-03 Thread dave selby
le /etc/motion/motion.2.conf [1] Thread is from /etc/motion/motion.1.conf [2] Thread is from /etc/motion/motion.2.conf [1] Thread started [2] Thread started [1] File of type 2 saved to: /var/lib/motion/20080203/01/tmp/175253.jpg ...etc ... I just can't work out why this is happenin

Re: [Tutor] Bad time to get into Python?

2008-02-03 Thread Alan Gauld
"Dotan Cohen" <[EMAIL PROTECTED]> wrote > coming of Python3 and the new syntax, is this a bad time to start > learning Python? I don't want to learn 2.x if 3.x will replace it, 3.x won't be the end of changes in Python, amy more than other languages change. While the changes for 3.x will be bigg

[Tutor] Bad time to get into Python?

2008-02-03 Thread Dotan Cohen
The little programming that I need I have been able to get away with silly php and bash scripts. However, my needs are getting bigger and I see Python as an ideal language for my console apps, and the occasional GUI that I might write for the wife. However, with the coming of Python3 and the new sy

Re: [Tutor] [tutor]Imagechop error

2008-02-03 Thread Alan Gauld
"Varsha Purohit" <[EMAIL PROTECTED]> wrote > AttributeError: 'str' object has no attribute 'load'I am unable > to > understand what is the problem. Can any one help me understand this > imagechop module ?? When posting errors don't just post the last line. Post the whole error message since