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


Groups > comp.lang.python > #72487

Re: Strange Behavior

From Peter Otten <__peter__@web.de>
Subject Re: Strange Behavior
Date 2014-06-03 10:01 +0200
Organization None
References <CANYcpZy3qZHRORFPTnvPcSV+uU2MHHPPcKuDXXuRvjNJBnKJKg@mail.gmail.com> <mailman.10571.1401732331.18130.python-list@python.org> <538d1532$0$29978$c3e8da3$5496439d@news.astraweb.com>
Newsgroups comp.lang.python
Message-ID <mailman.10601.1401782503.18130.python-list@python.org> (permalink)

Show all headers | View raw


Steven D'Aprano wrote:

> On Mon, 02 Jun 2014 20:05:29 +0200, robertw89 wrote:
> 
>> I invoked the wrong bug.py :/ , works fine now (this happens to me when
>> im a bit tired sometimes...).
> 
> Clarity in naming is an excellent thing. If you have two files called
> "bug.py", that's two too many.

In the case of the OP the code is likely to be thrown away once the bug is 
found. Putting all experiments into a single folder even with the overly 
generic name "bug" would have been "good enough" to avoid the problem.
 
> Imagine having fifty files called "program.py". Which one is which? How
> do you know? Programs should be named by what they do (think of Word,
> which does word processing, or Photoshop, which does photo editing), or
> when that isn't practical, at least give them a unique and memorable name
> (Outlook, Excel). The same applies to files demonstrating bugs.
 
Outlook and Excel are only good names because these are popular 
applications. If I were to name some private scripts in that style and not 
use them for a few months -- I don't think I'd have a clue what excel.py is 
meant to do. 

I have a few find_dupes dedupe_xxx compare_xxx scripts lying around and no 
idea which is which. So a reasonably clear name is not sufficient if there 
are other scripts that perform similar tasks.

One approach that seems to be working so far is to combine several scripts 
into one using argparse subparsers. This results in more frequent usage 
which means I can get away with short meaningless names, and infrequent 
actions are just one

$ xx -h

away.

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


Thread

Re: Strange Behavior robertw89@googlemail.com - 2014-06-02 20:05 +0200
  Re: Strange Behavior Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-06-03 00:22 +0000
    Re: Strange Behavior Chris Angelico <rosuav@gmail.com> - 2014-06-03 10:30 +1000
    Re: Strange Behavior Igor Korot <ikorot01@gmail.com> - 2014-06-02 17:49 -0700
    Choosing good names for things is difficult (was: Strange Behavior) Ben Finney <ben@benfinney.id.au> - 2014-06-03 10:57 +1000
      Re: Choosing good names for things is difficult (was: Strange Behavior) Rustom Mody <rustompmody@gmail.com> - 2014-06-02 19:06 -0700
        Re: Choosing good names for things is difficult (was: Strange Behavior) Chris Angelico <rosuav@gmail.com> - 2014-06-03 13:33 +1000
    Re: Strange Behavior Peter Otten <__peter__@web.de> - 2014-06-03 10:01 +0200
      Re: Strange Behavior Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-06-03 11:44 +0000

csiph-web