Skip to content

Instantly share code, notes, and snippets.

@innateessence
Last active July 24, 2018 23:36
Show Gist options
  • Save innateessence/b655ea039a75c91e0a474b8e8fe9feac to your computer and use it in GitHub Desktop.
Save innateessence/b655ea039a75c91e0a474b8e8fe9feac to your computer and use it in GitHub Desktop.
uniq.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Demonstration of how simple it can be to recreate
core functionality of various tools within python
'''
from sys import stdin, stdout, argv
class Uniq:
def __init__(self):
self.args = argv
self.lines = []
if len(argv) == 1 or '--' in argv:
self.output()
def output(self):
for line in stdin.readlines():
if line not in self.lines:
stdout.write(line)
self.lines.append(line)
if __name__ == '__main__':
Uniq()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment