Re: [Tutor] Python best practices

2009-11-30 Thread spir
ALAN GAULD dixit: > But as I said earlier the concept of multiple return > values in Python is similar to returning a struct in C. > The key thing is that the function has a single purpose > so if returning multiple values or a struct the values > within that group should be related to the sin

Re: [Tutor] Python best practices

2009-11-30 Thread Wayne Werner
On Mon, Nov 30, 2009 at 4:06 AM, ALAN GAULD wrote: > > Thats what I think is meant by bad practice in returning > multiple values. The function returns two completely different > things depending on some input flag. > Now that's something I definitely agree with! I can't think of a single case wh

Re: [Tutor] Python best practices

2009-11-30 Thread ALAN GAULD
lbert-Jan Roskam To: tutor@python.org; Alan Gauld Sent: Monday, 30 November, 2009 9:58:21 Subject: Re: [Tutor] Python best practices I'm currently reading the book "Code Complete" (I don't know the author name), which gives a lot of useful best practices. It's not speci

Re: [Tutor] Python best practices

2009-11-30 Thread Albert-Jan Roskam
In the face of ambiguity, refuse the temptation to guess. ~~ --- On Mon, 11/30/09, Alan Gauld wrote: From: Alan Gauld Subject: Re: [Tutor] Python best practices To: tutor@python.org Date: Monday, November 30, 2009, 1:57 AM "

Re: [Tutor] Python best practices

2009-11-29 Thread Lie Ryan
On 11/29/2009 8:59 PM, spir wrote: Lie Ryan dixit: - functions should return one value (im not 100% of this one) I 100% disagree or with this one. Could you explain this bit, Lie? I'm very interested. I use multiple-value result myself, for it's so practicle in given > cases. But it makes

Re: [Tutor] Python best practices

2009-11-29 Thread Kent Johnson
On Sat, Nov 28, 2009 at 1:26 PM, Lie Ryan wrote: > On 11/27/2009 7:03 PM, Stefan Lesicnik wrote: >> - functions should return one value (im not 100% of this one) > > I 100% disagree or with this one. Me too. Actually I think it is meaningless - every Python function returns one value, an instanc

Re: [Tutor] Python best practices

2009-11-29 Thread Alan Gauld
"spir" wrote > - functions should return one value (im not 100% of this one) I 100% disagree or with this one. Could you explain this bit, Lie? I'm very interested. I use multiple-value result myself, for it's so practicle in given cases. My take on this is that in Python its OK to return

Re: [Tutor] Python best practices

2009-11-29 Thread spir
Lie Ryan dixit: > > - functions should return one value (im not 100% of this one) > > I 100% disagree or with this one. Could you explain this bit, Lie? I'm very interested. I use multiple-value result myself, for it's so practicle in given cases. But it makes me uneasy; also have the impres

Re: [Tutor] Python best practices

2009-11-28 Thread Lie Ryan
On 11/27/2009 7:03 PM, Stefan Lesicnik wrote: hihi! (two in 1 day!) Is there a document, pep, wiki etc that defines best practice for python code? (maybe its more generic). PEP 8 is the official style guideline. I keep stumbling on things I think, it would be nice if someone mentioned thi

Re: [Tutor] Python best practices

2009-11-27 Thread Wayne Werner
On Fri, Nov 27, 2009 at 2:03 AM, Stefan Lesicnik wrote: > hihi! (two in 1 day!) > > Is there a document, pep, wiki etc that defines best practice for python > code? (maybe its more generic). > > This one is fairly comprehensive: http://www.python.org/dev/peps/pep-0008/ HTH, Wayne I keep stum

[Tutor] Python best practices

2009-11-27 Thread Stefan Lesicnik
hihi! (two in 1 day!) Is there a document, pep, wiki etc that defines best practice for python code? (maybe its more generic). I keep stumbling on things I think, it would be nice if someone mentioned this. Some things ive seen - keep you try blocks as small as possible, so you can isolate t