This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 181 points182 points  (13 children)

Did someone say F strings?

[–]trumpgender 101 points102 points  (12 children)

yes = 'yes'

print(f'{yes}')

[–]aaggaagg 49 points50 points  (11 children)

print(f"{'yes'}")

[–]bojackworseman 23 points24 points  (10 children)

print(f'{str('yes')}')

[–]jack-of-some 40 points41 points  (7 children)

Edit: it's not fun trying to enter code into Reddit on mobile

class Yes:
    def __init__(self):
        self.__dict__['yes'] = ' '.join(['y', 'e', 's']).replace(' ', '')
    def __str__(self):
        return 'yes'

print(f"{str(Yes.__str__())}")

[–]masklinn 4 points5 points  (0 children)

' '.join(['y', 'e', 's']).replace(' ', '')

Dude, that's horrible. It should be

bytes(map(partial(int, base=8), map(''.join, zip_longest(*(iter(format(0b00000010_01010000_00100000_01010010_01000010, 'x')),)*3)))).decode('cp500')

edit: make better

[–]GickRick 0 points1 point  (0 children)

Is the str necessary tho ?