DEV Community

Discussion on: If Statement Golf: what's the longest one you've seen?

Collapse
 
jencaadam profile image
Adam Jenča • Edited
if (len(_ll)>1 or '=' in _ll) and isinstance(_ll[0],str) and  _ll[0].split()[0]==_ll[0] and '(' not in _ll[0] and '[' not in _ll[0]:
Enter fullscreen mode Exit fullscreen mode

only 133 characters long, but coded in python - spare-space language.

Whole if-else block looks like

if 'name' not in kwargs and len(args)<3:


    if (len(_ll)>1 or '=' in _ll) and isinstance(_ll[0],str) and  _ll[0].split()[0]==_ll[0] and '(' not in _ll[0] and '[' not in _ll[0]:
         name=_ll[0]
    else:
         name='WraPy'
else:
    if 'name' in kwargs:
        name=kwargs['name']
        del kwargs['name']
    else:
        name=args[2]
        del args[2]
Enter fullscreen mode Exit fullscreen mode