Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #78176 > unrolled thread

Re: Love to get some feedback on my first python app!!!

Started byChris Angelico <rosuav@gmail.com>
First post2014-09-23 04:25 +1000
Last post2014-09-23 13:59 +1000
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Love to get some feedback on my first python app!!! Chris Angelico <rosuav@gmail.com> - 2014-09-23 04:25 +1000
    Re: Love to get some feedback on my first python app!!! alex23 <wuwei23@gmail.com> - 2014-09-23 13:59 +1000

#78176 — Re: Love to get some feedback on my first python app!!!

FromChris Angelico <rosuav@gmail.com>
Date2014-09-23 04:25 +1000
SubjectRe: Love to get some feedback on my first python app!!!
Message-ID<mailman.14228.1411410342.18130.python-list@python.org>
On Tue, Sep 23, 2014 at 4:24 AM, Chris Kaynor <ckaynor@zindagigames.com> wrote:
> On Mon, Sep 22, 2014 at 8:52 AM, Jean-Michel Pichavant
> <jeanmichel@sequans.com> wrote:
>>
>> Anyway it's seems we agree anyway because your example perfectly
>> illustrate what I was trying to demonstrate:
>> print(cells[2]) is very easy to understand, most of people would say 'no
>> need of any comment'. I think it does require a comment.
>
>
> But the thing that requires the comment is the "2", not the "print" or the
> "cells". And that comes to a more common issue: any number other than 0 or 1
> in code most likely needs a comment (that comment could be merely a variable
> name). Values of 0 or 1 may need a comment, but there are plenty of cases
> where they are used quite clearly - its much less likely that other numbers
> have obvious meaning.

Or in this case, replacing the list with a namedtuple is probably more useful.

ChrisA

[toc] | [next] | [standalone]


#78190

Fromalex23 <wuwei23@gmail.com>
Date2014-09-23 13:59 +1000
Message-ID<lvqr6u$fo1$1@dont-email.me>
In reply to#78176
On 23/09/2014 4:25 AM, Chris Angelico wrote:
> On Tue, Sep 23, 2014 at 4:24 AM, Chris Kaynor <ckaynor@zindagigames.com> wrote:
>> But the thing that requires the comment is the "2", not the "print" or the
>> "cells". And that comes to a more common issue: any number other than 0 or 1
>> in code most likely needs a comment (that comment could be merely a variable
>> name). Values of 0 or 1 may need a comment, but there are plenty of cases
>> where they are used quite clearly - its much less likely that other numbers
>> have obvious meaning.
>
> Or in this case, replacing the list with a namedtuple is probably more useful.

Depending on the use case, binding a slice to a name can also help 
clarify things.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web