Skip to content

Instantly share code, notes, and snippets.

@secemp9
Created August 22, 2022 16:07
Show Gist options
  • Save secemp9/0903bec6a065ee459beb5651528fa854 to your computer and use it in GitHub Desktop.
Save secemp9/0903bec6a065ee459beb5651528fa854 to your computer and use it in GitHub Desktop.
Emulating linux pipes on python 101 (or is it??)

I'm gonna make this quick because time is piping itself away! (bad joke)

So how to make a linux pipe with/under/inside/you_get_it python?

First, let's take into account the context here: is it just as syntax? or as an actual linux pipes? buffering only?

Your context for what you want in your linux pipe emulation need to be defined, but before you do it, let me list a couple of possibility:

If it's just syntax then:

  • AST
  • regex
  • string.replace

If it's just buffering:

  • queue
  • list
  • generator
  • temporary files
  • variable

if it's any other context...then I need more time. Will edit in a bit...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment