Simple, elegant, pythonic solution for switch statement

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • python_only

    Simple, elegant, pythonic solution for switch statement

    Check it out!

    Readable switch construction without lambdas or dictionaries:



  • Klaus Alexander Seistrup

    #2
    Re: Simple, elegant, pythonic solution for switch statement

    python_only wrote:
    [color=blue]
    > http://aspn.activestate.com/ASPN/Coo.../Recipe/410692[/color]

    Neat solution!

    --
    Klaus Alexander Seistrup
    Magnetic Ink, Copenhagen, Denmark

    Comment

    • bruno modulix

      #3
      Re: Simple, elegant, pythonic solution for switch statement

      python_only wrote:[color=blue]
      > Check it out!
      >
      > Readable switch construction without lambdas or dictionaries:
      >
      > http://aspn.activestate.com/ASPN/Coo.../Recipe/410692
      >[/color]
      Not sure I'll have a need for it, but, yes, nice job !-)

      --
      bruno desthuilliers
      python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
      p in 'onurb@xiludom. gro'.split('@')])"

      Comment

      Working...