1. 12
  1.  

  2. 15

    There’s a certain pleasure in writing code that only other functional programmers can read. Also, it’s super cool to take a function and turn it into a one-liner.

    🚨 🚨 🚨 🚨 This could’ve been a tongue-in-cheek thing, but this is a HUGE no-no to me. Code is meant to be readable. If you want to make indecipherable nonsense, you can always go back to perl. Python is meant to be easy to read, easy to use. Not some sort of goofy club where people can feel cool because they wrote terrible code.

    Functional Programming Isn’t Pythonic

    I don’t agree with this. It can be pythonic, but it can also be pure garbage. It really depends on the person and how they choose to write it.

    1. 2

      The Pythonic stuff is just Word of God: Guido van Rossum considers the canonical way to do map and filter is a list comprehension.

      1. 1

        Also, it’s super cool to take a function and turn it into a one-liner.

        this is a HUGE no-no to me. Code is meant to be readable

        Sure. There are limits, though. I wouldn’t expect someone who’s been studying python for a week to be able to grok the code for twisted or django. I don’t think it’s unreasonable to write a project in a function style, if that’s more readable for the maintainers; the people for whom readability matters are the ones writing the code.

        1. 4

          I feel like this is obvious. You wouldn’t expect someone new in a language to fully understand new syntax that is foreign to them regardless of programming style.

          My point is that our job as coders is to make it readable and maintainable, not clever or purposely obfuscated (unless you’re playing code golf).

      2. 3

        I mean, writing Python in this fashion really feels like fighting the tool.

        1. 3

          Writing? Not at all. It’s not Haskell or lisp but it’s good to write. Reading it? That’s the real problem. Source: I wrote heavily functional python after switching back from Scala and I have no idea what a lot of that code is doing.

        2. 1

          This was a great read, thanks!