[CentralOH] Pipeness _Within_ Python

jep200404 at columbus.rr.com jep200404 at columbus.rr.com
Thu Aug 16 21:26:34 CEST 2012


How would one do the following[1] entirely within Python[2]? 

    python mogrify.py <(cat "$filename" \
    | tee >(sha1sum >&3) >(wc -c >&4) /dev/null \
    | gunzip | tee >(sha1sum >&5) >(wc -l -c >&6) /dev/null)



[1] Calculate sha1sums and byte count of compressed and 
    uncompressed file, reading file only once (without using 
    temporary files and without saving file in memory).

[2] Is it the wrong thing to ask for, 
    considering Python nature and Unix shell script nature?  
    If so, what question should I ask? 
    http://www.catb.org/~esr/writings/unix-koans/ten-thousand.html

    By the way, while looking for [2], I found "Why Python?"[4]

[4] "Why Python?" 
    http://www.linuxjournal.com/article/3882
    Guido van Rossum told me [Eric Raymond] once he thought 
    this article was the single most effective piece of Python 
    evangelism ever. For some years it was the single most 
    popular back article on the LJ website.



More information about the CentralOH mailing list