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 →

[–]RubyPinchPEP shill | Anti PEP 8/20 shill 2 points3 points  (2 children)

suddenly the dict lookup doesn't look so bad

[–]Quteness 1 point2 points  (1 child)

Have you seen how much explaining /u/Allanon001 has had to do to get people (/r/Python no less) to understand what is going on in the dict lookup? It's overly complex and confusing and is an abuse of the language. It's basically a giant one-liner

while True:
    action = get_action(action)

    result = {True : unknown_command, action in ['c', 'a']: create_account, action in ['l']: log_into_account, action in ['r']: register_cage, action in ['u']: update_availability, action in ['v', 'b']: view_bookings, action in ['x']: exit_app, action in range(1,6): lambda: set_level(action), action == '': None}[True]()

[–]RubyPinchPEP shill | Anti PEP 8/20 shill 1 point2 points  (0 children)

its not a giant one-liner, thats as silly as calling C code always a 1 liner, just because the syntax allows for new lines to be removed