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


Groups > comp.lang.python > #78141

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

References <42e68de9-7528-46fc-8c74-c0baa1d6199e@googlegroups.com> <4e75613a-706a-4441-b94a-49dbedf3df28@googlegroups.com>
Date 2014-09-22 22:23 +1000
Subject Re: Love to get some feedback on my first python app!!!
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.14197.1411388582.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Mon, Sep 22, 2014 at 10:00 PM,  <vek.m1234@gmail.com> wrote:
> https://github.com/Veek/Python/blob/master/IRC/Hexchat/fake_ctcp.py
> that's not too bad as far as readability is concerned and it's bereft of all comments {:p

Sure, I can work out what it's doing without comments. Doesn't mean
comments are bad, though. Also, without comments, I have no idea *why*
it's doing what it does. For instance, this:

> def debug(msg):
>     hexchat.prnt('{}'.format(msg))

Why not just do this:
debug = hexchat.prnt

Or, better still, just use hexchat.prnt() everywhere, instead of
having a local name? (You happily use hexchat.* in other places.) Is
it meant to be monkey-patched externally? Is it meant to be a
one-place edit? What's the purpose of this one-line function?

> date = str(date_s) + ' ' + str(hour) + ':' + str(min) + ':' + str(sec)

You use .format() in places where it's completely unnecessary, but
eschew it when it would make your code more readable.

date = "%s %s:%s:%s" % (date_s, hour, min, sec)
date = "{} {}:{}:{}".format(date_s, hour, min, sec)

So, comments would definitely help. In some cases, would help a lot.

ChrisA

Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Love to get some feedback on my first python app!!! Nicholas Cannon <nicholascannon1@gmail.com> - 2014-09-20 06:16 -0700
  Re: Love to get some feedback on my first python app!!! Chris Angelico <rosuav@gmail.com> - 2014-09-21 00:58 +1000
  Re: Love to get some feedback on my first python app!!! Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-09-20 16:30 +0100
  Re: Love to get some feedback on my first python app!!! Nicholas Cannon <nicholascannon1@gmail.com> - 2014-09-20 18:33 -0700
    Re: Love to get some feedback on my first python app!!! Chris Angelico <rosuav@gmail.com> - 2014-09-21 11:48 +1000
  Re: Love to get some feedback on my first python app!!! Nicholas Cannon <nicholascannon1@gmail.com> - 2014-09-20 20:44 -0700
  Re: Love to get some feedback on my first python app!!! Nicholas Cannon <nicholascannon1@gmail.com> - 2014-09-21 01:53 -0700
    Re: Love to get some feedback on my first python app!!! vek.m1234@gmail.com - 2014-09-22 02:00 -0700
      Re: Love to get some feedback on my first python app!!! Chris Angelico <rosuav@gmail.com> - 2014-09-22 19:23 +1000
        Re: Love to get some feedback on my first python app!!! vek.m1234@gmail.com - 2014-09-22 04:47 -0700
          Re: Love to get some feedback on my first python app!!! Chris Angelico <rosuav@gmail.com> - 2014-09-22 22:09 +1000
            Re: Love to get some feedback on my first python app!!! vek.m1234@gmail.com - 2014-09-22 06:35 -0700
              Re: Love to get some feedback on my first python app!!! C Smith <illusiontechniques@gmail.com> - 2014-09-22 06:48 -0700
                Re: Love to get some feedback on my first python app!!! vek.m1234@gmail.com - 2014-09-22 08:12 -0700
              Re: Love to get some feedback on my first python app!!! Chris Angelico <rosuav@gmail.com> - 2014-09-22 23:57 +1000
              Re: Love to get some feedback on my first python app!!! Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-09-22 17:17 +0100
              Re: Love to get some feedback on my first python app!!! Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-09-22 17:17 +0100
              Re: Love to get some feedback on my first python app!!! Chris Angelico <rosuav@gmail.com> - 2014-09-23 02:58 +1000
          Re: Love to get some feedback on my first python app!!! Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-09-22 17:10 +0100
          Re: Love to get some feedback on my first python app!!! Chris Angelico <rosuav@gmail.com> - 2014-09-23 02:26 +1000
  Re: Love to get some feedback on my first python app!!! vek.m1234@gmail.com - 2014-09-22 05:00 -0700
    Re: Love to get some feedback on my first python app!!! Chris Angelico <rosuav@gmail.com> - 2014-09-22 22:23 +1000
    Re: Love to get some feedback on my first python app!!! Larry Martell <larry.martell@gmail.com> - 2014-09-22 09:02 -0400
    Re: Love to get some feedback on my first python app!!! Chris Angelico <rosuav@gmail.com> - 2014-09-22 23:21 +1000
    Re: Love to get some feedback on my first python app!!! Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-09-22 17:11 +0100
  Re: Love to get some feedback on my first python app!!! Nicholas Cannon <nicholascannon1@gmail.com> - 2014-09-22 06:17 -0700
    Re: Love to get some feedback on my first python app!!! Chris Angelico <rosuav@gmail.com> - 2014-09-22 23:28 +1000
    Re: Love to get some feedback on my first python app!!! Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-09-22 17:14 +0100
  Re: Love to get some feedback on my first python app!!! Nicholas Cannon <nicholascannon1@gmail.com> - 2014-09-22 06:19 -0700

csiph-web