dedicated to programmer_network

quote: "I never wanna write something like - if x is a string - again"
mail@pastecode.io avatar
unknown
python
a year ago
589 B
5
Indexable
Never
from time import sleep

string = sleep

def angry_if_not_string( string: str ):
    '''my coworker will write here'''
    no_string_flag = False
    if not isinstance(string, str):
        no_string_flag = True
        while no_string_flag:
            try:
                string = string.to_string()
            except:
                print('what the')
                try:
                    string = str(string)
                except:
                    print('okay, we lost')
            no_string_flag -= 0.5 # ;-)
    
    return 'a ' + string
    
angry_if_not_string( string )