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

2008-02-04 Thread Eric Brunson
Dotan Cohen wrote: On 03/02/2008, Kent Johnson <[EMAIL PROTECTED]> wrote: 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. H

Re: [Tutor] newbie code review please!

2008-02-04 Thread Kent Johnson
Tyler Smith wrote: > That cleaned up a lot. However, I couldn't figure out a way to do > random.choice(word_hash[(w1, w2)]) on a dict with set-type values. Ah, sorry; random.choice() needs an indexable sequence. Try w1, w2 = w2, random.sample(word_hash[(w1, w2)], 1)[0] random.sample() works w

Re: [Tutor] os.system() problem

2008-02-04 Thread Eric Brunson
dave selby wrote: > Hi all, > > I am not sure if this is a Python or bash issue :). > > In bash if I execute 'motion' with the following ... > > [EMAIL PROTECTED]:~/.kde/share/apps/kmotion$ motion &> /dev/null & > [1] 10734 > [EMAIL PROTECTED]:~/.kde/share/apps/kmotion$ > > I get what I expect, a b

Re: [Tutor] newbie code review please!

2008-02-04 Thread Tyler Smith
On Sun, Feb 03, 2008 at 04:35:08PM -0500, Kent Johnson made several helpful suggestions: Thanks! That cleaned up a lot. However, I couldn't figure out a way to do random.choice(word_hash[(w1, w2)]) on a dict with set-type values. The closest I could get was word_hash[(w1, w2)].pop(), but then I n

Re: [Tutor] newbie code review please!

2008-02-04 Thread tyler
On Sun, Feb 03, 2008 at 04:35:08PM -0500, Kent Johnson made several helpful suggestions: Thanks! That cleaned up a lot. However, I couldn't figure out a way to do random.choice(word_hash[(w1, w2)]) on a dict with set-type values. The closest I could get was word_hash[(w1, w2)].pop(), but then I n

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

2008-02-04 Thread Andre Roberge
On Feb 4, 2008 1:26 PM, Eric Brunson <[EMAIL PROTECTED]> wrote: > > Dotan Cohen wrote: > > Like I mentioned earlier, I'm more interested in my learning being 3.x > compatible, not my scripts. If all I need to do is learn to print("") > instead of print"" then that's fine. > > > Basically, if you

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

2008-02-04 Thread Dotan Cohen
On 03/02/2008, Kent Johnson <[EMAIL PROTECTED]> wrote: > 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 t

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

2008-02-04 Thread Dotan Cohen
On 04/02/2008, Andre Roberge <[EMAIL PROTECTED]> wrote: > I have complete unit tests for about 20 of the modules I wrote and it > was very easy to make them work (with no errors) under all 4 Python > versions. There are only a small number of places where the > transition from 2.x to 3.0 is g

Re: [Tutor] newbie code review please!

2008-02-04 Thread tyler
On Mon, Feb 04, 2008 at 03:27:35PM -0400, tyler wrote: > On Mon, Feb 04, 2008 at 11:56:17AM -0500, Kent Johnson wrote: > > Tyler Smith wrote: > > > >> That cleaned up a lot. However, I couldn't figure out a way to do > >> random.choice(word_hash[(w1, w2)]) on a dict with set-type values. > > > > Ah

Re: [Tutor] good reference book recommendations

2008-02-04 Thread tyler
Hi, At the risk of beating a well-dead horse, I'm looking for book suggestions. I've already got Core Python Programming, but I find it doesn't quite suit my needs. I'd like a comprehensive and *concise* reference to the core language and standard libraries. It looks like Beazely's Essential Refer

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

2008-02-04 Thread Chris Fuller
On Sunday 03 February 2008 17:35, GTXY20 wrote: > 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

Re: [Tutor] good reference book recommendations

2008-02-04 Thread bhaaluu
Being a book snob, I'd go for the O'Reilly Nutshell book over the SAMS Essential Reference. I've always had good luck with books published by O'Reilly. I have neither of the books you asked about, because I use online docs. I don't need no steenkin' dead tree Python reference. 8^P Actually, I've he

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

2008-02-04 Thread Michael Langford
OT Aside: Anyone ever used PSP pages? Seems like a good substitute for PHPish tasks, but I've not seen many users. As to the actual question, PHP can call python through a variety of means. One such one I'm familiar with is XMLRPC. PHP: http://phpxmlrpc.sourceforge.net/ Python: http://www.ibm.co

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

2008-02-04 Thread Eric Brunson
Michael Langford wrote: > OT Aside: > Anyone ever used PSP pages? Seems like a good substitute for PHPish > tasks, but I've not seen many users. > I have, but I find generating my HTML with classes I wrote to be more to my tastes. I did PHP for years and I'm just not a fan of the way it mixe