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


Groups > comp.lang.python > #52511

Re: Am I not seeing the Error?

References (2 earlier) <kue7n0$heh$1@ger.gmane.org> <mailman.555.1376438468.1251.python-list@python.org> <b704a4F85drU1@mid.individual.net> <CAN1F8qU8YEL3HgcOoUqiwA87=zM8=VHZCgJP6_x3hUEX7iCSvg@mail.gmail.com> <CAPTjJmq0256eGROAk+K6HL0fndbpWwZbs3POVHzzR+bYB1zu4g@mail.gmail.com>
From Joshua Landau <joshua@landau.ws>
Date 2013-08-14 13:34 +0100
Subject Re: Am I not seeing the Error?
Newsgroups comp.lang.python
Message-ID <mailman.574.1376483714.1251.python-list@python.org> (permalink)

Show all headers | View raw


On 14 August 2013 13:07, Chris Angelico <rosuav@gmail.com> wrote:
> On Wed, Aug 14, 2013 at 7:59 AM, Joshua Landau <joshua@landau.ws> wrote:
>>
>> What's wrong with cat? Sure it's superfluous but what makes it *bad*?
>> Personally I often prefer the pipe "cat x | y" form to "x < y"... or
>> "< y x".
>
> What's the use of it, in that situation? Why not simply use
> redirection? (Though you have the letters backward; "cat y | x" would
> be the equivalent of your others. Typo, I assume.) You're forking a
> process that achieves nothing, if your cat has just one argument.
>
> Of course, there ARE many good uses for cat. If you give it multiple
> arguments, or if you have arguments that modify the output on the way
> through (eg "cat -n"), then it's not the same as redirection. And some
> programs behave differently if stdout is a tty, so the quickest way to
> get the porcelain version of something is to append "|cat" to the
> command. Or maybe you need to retrieve something that only root can
> read, so you use "sudo cat /x/y/z|somescript". But if you could spell
> it "x < y", then why not do so?

Because "cat y | x" often reads nicer. It's the whole "input ->
function -> function -> ... -> output" thing.

I especially hate "y < input > output" which reads awfully not matter
where you chuck the spaces. "cat input | y > output" however, is
acceptable.

Honestly I do think Python would do well to get a pipe operator,
because in some circumstances it's just cleaner.

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


Thread

Am I not seeing the Error? Devyn Collier Johnson <devyncjohnson@gmail.com> - 2013-08-10 22:19 -0400
  Re: Am I not seeing the Error? John Gordon <gordon@panix.com> - 2013-08-12 14:47 +0000
  Re: Am I not seeing the Error? Denis McMahon <denismfmcmahon@gmail.com> - 2013-08-13 20:28 +0000
    Re: Am I not seeing the Error? Dave Angel <davea@davea.name> - 2013-08-13 21:16 +0000
    Re: Am I not seeing the Error? MRAB <python@mrabarnett.plus.com> - 2013-08-14 00:44 +0100
    Re: Am I not seeing the Error? Ned Batchelder <ned@nedbatchelder.com> - 2013-08-13 20:00 -0400
      Re: Am I not seeing the Error? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2013-08-14 13:20 +1200
        Re: Am I not seeing the Error? Joshua Landau <joshua@landau.ws> - 2013-08-14 07:59 +0100
        Re: Am I not seeing the Error? Chris Angelico <rosuav@gmail.com> - 2013-08-14 13:07 +0100
          Re: Am I not seeing the Error? Roy Smith <roy@panix.com> - 2013-08-14 08:39 -0400
        Re: Am I not seeing the Error? Joshua Landau <joshua@landau.ws> - 2013-08-14 13:34 +0100

csiph-web