r/badcode • • Feb 16 '21

[deleted by user]

[removed]

30 Upvotes

77 comments sorted by

View all comments

3

u/dstlny_97 Feb 22 '21

idk anymore


import os as so
import string as gnirts

a = gnirts.ascii_lowercase
aaa = open
aaaa = reversed

for aaaaaa in aaaa(a):
   aaaaaaa = f'{aaaaaa}.txt'
   if not so.path.exists(aaaaaaa):
      with aaa(aaaaaaa, 'w') as aaaaaaaa:
         aaaaaaaa.write(aaaaaa)

def contains_az(aa):
    return all(
        any(
            aaaaaaaaa
            ==
            aaaaaaaa
            ==
            [
                aaaaaaaaaa
                for
                aaaaaaaaaa
                in
                aaa(f'{aaaaaaaaa.lower()}.txt', 'r')
            ][0]
            for 
            aaaaaaaa
            in
            aa
        )
        
        for
        aaaaaaaaa
        in
        a
    )

print(contains_az(a)) # True
print(contains_az('the quick brown fox jumps over the lazy dog')) # True
print(contains_az('Arizona')) # False

3

u/dstlny_97 Feb 22 '21
  • Overrides built-in functions.
  • Overall bad variable names
  • Uses files as a way to store the letters of the alphabet.
  • Uses all()/any() in disgusting ways.
  • Nested list comprehensions.
  • No exception handling.
  • Uses import x as y syntax, but wrongly.
  • I wrote it, and idk how it works but it works.

0

u/[deleted] Feb 22 '21

[deleted] — view deleted comment

2

u/dstlny_97 Feb 23 '21

Same tbh

1

u/AutoModerator Feb 22 '21

It looks like this comment contains a code block delimited with triple backticks. Unfortunately reddit does not have universal support for this syntax and your comment will not render correctly on old reddit and most mobile apps.

For the benefit of people on old reddit, this link will take you to a correct rendering of the comment.

/u/dstlny_97, it would be appreciated, but not required, if you could edit your comment to use the more compatible four space indention format. For single lines or inline code you can use single backticks.

You can find some examples in the reddit help documentation.


I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.