Re: [Tutor] First code snipet

2009-07-27 Thread Dave Angel
Darth Kaboda wrote: Good point. It is important to state your goal for the code, preferably in comments in your code, as well as in the message asking us the question. Suggest you include a doc-string for each class and method declaration. But it's important to tell us how you expect to use i

Re: [Tutor] First code snipet

2009-07-26 Thread Darth Kaboda
> Good point. It is important to state your goal for the code, preferably > in comments in your code, as well as in the message asking us the > question. Suggest you include a doc-string for each class and method > declaration. > > But it's important to tell us how you expect to use it, as wel

Re: [Tutor] First code snipet

2009-07-26 Thread Alan Gauld
"Dave Angel" wrote len() is very fast, so there's no need for a separate variable to keep track of the lengths of inpile1 and inpile2. So eliminate all refs to pile1c and pile2. In the while, just use while len(inpile1) and len(inpile2): Or even simpler: while inpile1 and inpile2:

Re: [Tutor] First code snipet

2009-07-26 Thread Dave Angel
Darth Kaboda wrote: Subject: Re: [Tutor] First code snipet From: andr...@kostyrka.org To: darthkab...@msn.com CC: tutor@python.org Date: Sun, 26 Jul 2009 03:02:27 +0200 Some things: 1) It's Python, not Phython. 2) Slightly shorter solution to your problem: import random input =

Re: [Tutor] First code snipet

2009-07-26 Thread Alan Gauld
"Darth Kaboda" wrote The one worry I have is not coding things the Phython way ...So would like to have people look at a simplistic class rpile = pile1[0:0] #get blank copy of the passed in object types. This will return an empty list regardless of the type of passed in object. T

Re: [Tutor] First code snipet

2009-07-25 Thread Wayne
On Sat, Jul 25, 2009 at 7:15 PM, Darth Kaboda wrote: > I'm starting to learn Python as it seems to be adopted by many companies > that I've been looking to apply to. I used the book Learning Phython to get > the basics of the language and many of the gotcha's. I think I know enough > of the basi

Re: [Tutor] First code snipet

2009-07-25 Thread Darth Kaboda
> Subject: Re: [Tutor] First code snipet > From: andr...@kostyrka.org > To: darthkab...@msn.com > CC: tutor@python.org > Date: Sun, 26 Jul 2009 03:02:27 +0200 > > Some things: > > 1) It's Python, not Phython. > 2) Slightly shorter solution to your pro

Re: [Tutor] First code snipet

2009-07-25 Thread Andreas Kostyrka
Some things: 1) It's Python, not Phython. 2) Slightly shorter solution to your problem: import random input = range(53) random.shuffle(input) print input 3) The important part here is that reimplementing something that is in the standard library does not make sense usually. 4) A more sensible

[Tutor] First code snipet

2009-07-25 Thread Darth Kaboda
I'm starting to learn Python as it seems to be adopted by many companies that I've been looking to apply to. I used the book Learning Phython to get the basics of the language and many of the gotcha's. I think I know enough of the basic features of the language to start playing around and can u