-
Notifications
You must be signed in to change notification settings - Fork 1
/
__cheeky.py
59 lines (51 loc) · 1.49 KB
/
__cheeky.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
string = """I like python programming
Hello world, my name is tom"""
# This is necessary decorator
def weird_concat_strip(fun):
def wrapper(line):
return fun(line).strip()
return wrapper
# Oh man, this is really weird concatenation! But hey, it works!
def weird_concat(line):
return ''.join([line for _ in range(1)] + ['\n' for _ in range(2)] + [line for _ in range(1)] + ['\n'])
# Decorators, decorators everywhere!
@weird_concat_strip
def last_weird_concat(line):
# random comment, this should make it more clear
return weird_concat(line)
def main(what_are_we_doing):
print(what_are_we_doing)
# oh hey, do we even need this one?
unnecessary_variable = None
# DO NOT DELETE THE NEXT LINE
line = ""
#TODO add decorators
for c in string:
# Heart warming Poem
# by bored coder
#
# char by char,
# in the string,
# don't use split
# that's the win
#
# don't use Python,
# C's the way,
# stupid indent
# anywaay
#
# TODO missing elif?
if c != '\n':
# isn't there a better way
line = line + c
else:
# nested if, cause what if!
if line != "":
print(weird_concat(line))
line = ""
else:
# why do we need that decorator anyway?
print(last_weird_concat(line))
if __name__ == '__main__':
text = "Running"
main(text)