80

"Pythonists don't comment, they write readable code."

Yea, tell that to the list comprehension with three lambdas

Comments
  • 5
    👀
  • 8
    Well, time to get some hot rod and apply to their asses 😉
  • 6
    Tell that to anyone who's ever written code.
  • 1
    What does that look like?
  • 12
    To be fair, just because you *can* write unreadable BS in a language it doesn't mean the language is bad or unreadable itself.

    That being said, I've seen enough python projects.. they definitely do comment code... At least everyone does function and class level comments!
  • 5
    Fuck uncle bob. Comments are always good. If you don’t want to see, download a plugin to hide them. I won’t lose any sleep because of some obsolete guy’s opinions.
  • 2
    I may be biased because I only use python for scripts. But if it’s longer than 200 lines, ciao python for me.
  • 1
    @frogstair you are a good person.
  • 1
    Can lambdas span over multiple lines now or are we still actively preventing people from writing readable code in the name of saving a total of 1 closing curly? (because you still need a colon to start a block)
  • 1
    What would this look like (in an unreadable example)? Curious now I've heard all the stories 🤔
  • 3
    @jkommeren

    randomPasswordGenerator = \
    (lambda random, string: # level 1
    (lambda characters: # level 2
    lambda length: ''.join(random.choice(characters) for i in xrange(length)) # level 3
    )(string.digits + string.letters) # level 2 args
    )(
    __import__('random'), # level 1 args
    __import__('string')
    )

    Found in the wild and compiled in https://gist.github.com/e000/...
  • 3
  • 2
    @InvisibleMe what the absolute FUCK is that gist.
  • 1
    @InvisibleMe oh the comments below the code and the comments in the code. lol

    "It looks like lisp :O"
  • 1
    @InvisibleMe
    I didn't realize, that modules are actually first class citizen.
    So we can write OCaml-style functors in Python... Nice.
  • 1
    @Oktokolo
    With great power comes great code reviewing discussions over "should I let this Python functor code in my database or is this a slippery slope to LISP?"
  • 1
    @InvisibleMe
    Well, a functor could easily be implemented as a pretty human-readable class taking a module on construction.
    No need to do it the lisp-lambda way.
  • 0
    @Oktokolo _everything_ is a object and modules are just a subclass of object.
  • 1
    So far everyone claiming they have the best [insert anything] (or in this case they [unlike other languages] write readable code [which reads as pythonists have the most readable code]) always proved they have the shittiest [thing they claimed to be the best at]

    This rule works from pasta carbonara to sick dance moves to code.

    Corollary 1: if you are good at something you don't need to claim it, you can show it.
  • 0
    Like if docstrings are not a thing.
    Funny.
  • 0
    Most of code comments I see in the wild are about the how something is being done, but not about the why, which in general is what needs being explained.
Add Comment