5 ms·
This seems to be a simple wrapper around subprocess, but I'm afraid it is not changing things dramatically. Overall, I don't agree that Sultan's syntax is any m
by onyb 9y ago
This seems to be a simple wrapper around subprocess, but I'm afraid it is not changing things dramatically. Overall, I don't agree that Sultan's syntax is any more Pythonic than subprocess itself.
+1 for https://sultan.readthedocs.io/en/latest/sultan-examples.html#example-5-redirecting-output-to-file https://sultan.readthedocs.io/en/latest/sultan-examples.html...
I think it would be interesting if you could iterate on the results of "ls -l", where each row is represented by an object.
- friendzis 9y agoAnd then I remember that Windows PowerShell does (attempts to, to be fair) exactly that
- stinos 9y agoattempts to, to be fair Output of ls in PS is an Array of objects (DirectoryInfo or FileInfo instances). How is that merely an attempt?
- friendzis 9y agoWhile PS-native stuff yield objects, not all pre-PS utilities/builtins are overriden or have interface for PS and output old fashioned text blob, which is not automagically parsed in any way by PS. My comment was system-level, not utility-level.
- aeroxis 9y agoRepresenting each row as an object works, but it ends up having us write custom objects for different result types. When you run Sultan().ls('-l'), you will get back a list of Strings, which you can freely use in Python for your specific needs (like use a Regex to fetch date/times or file size). I felt like this offers developers the best flexibility, rather than trying to customize each output (which will definitely make the codebase very confusing)