On 2013-06-30, Chris Angelico <ros...@gmail.com> wrote: > So, here's a challenge: Come up with something really simple, > and write an insanely complicated - yet perfectly valid - way > to achieve the same thing. Bonus points for horribly abusing > Python's clean syntax in the process. > > Go on, do your worst!
I've often thought it was redundant for Python to support 'if' when it has dictionaries, cf the rationale for having no 'switch'. valid_name = None while not valid_name: name = input("Enter your name: ") valid_name = { True: lambda: print("No name longer than 20 letters."), False: lambda: True, }[len(name) > 20]() Much better. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list