7 ms·
Why not use pipes for piping? e.g. print du("*", "-sb") | sort("-rn")
by petsos 15y ago
Why not use pipes for piping? e.g. print du("*", "-sb") | sort("-rn")
- rplnt 15y agoWould break syntax too much and would make even less sense to python user reading the code. But there is several packages which does this (piping using pipes), maybe you could use that.
- cwp 15y agoMy thought too. Also > and < for file redirection.
- veyron 15y agoIf you interpret the return value as a file (output file handle) then the function application method makes sense. This really falters when trying to use tee, but then again using pipes doesnt help either.
- logic 15y agoOrder of evaluation; du() will be instantiated, sort() will be instantiated, and then du().__or__() is evaluated, which means you won't have du's stdout to attach to stdin on sort when it's instantiated. Figuring out a way around this (mocking up an fd to pass to sort at instantiation time that blocks until stdout on du is available) is left as an exercise to the reader. I've already said too much. ;)