Re:PEP 594 – Removing dead batteries from Python's standard ...
by naniwaduni on Wednesday May 22, 2019 @07:03PM
(#19986541)
Filters over lines of text may be domain-specific, but it sure as hell spans a lot of domains.
[ Parent
| on HN ]
Re:PEP 594 – Removing dead batteries from Python's standard ...
by jstimpfle on Wednesday May 22, 2019 @07:12PM
(#19986621)
Idk, it never occurred to me the need for a library that does more than "for line in sys.stdin:" but less than what you can easily write in under a minute.
Re:PEP 594 – Removing dead batteries from Python's standard ...
by rabidrat on Wednesday May 22, 2019 @07:26PM
(#19986715)
It handles files being passed on the command line too. Your particular usage might only take a minute, but to make it play nice with other expected CLI usages, takes more thought (and you will probably forget something).
Re:PEP 594 – Removing dead batteries from Python's standard ...
by masklinn on Thursday May 23, 2019 @03:59AM
(#19989530)
> Idk, it never occurred to me the need for a library that does more than "for line in sys.stdin:"
Of course if you'd only used fileinput for that it would be worthless.
However what it does is way more useful, namely iterate on the lines of all files provided as parameter (or sys.argv[:1]), fallback to sys.stdin if no files were provided, and swap the special sentinel `-` by sys.stdin.