Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I work in a place where people don't use spaces and don't use empty lines to separate logical groups of lines. It's a real pain for me who is a code format junkie as our code ends up being an ugly pack of unrelated crap that's really hard to read.

It's Python code and I find it uglier than some fairly large C++ project I used to work on.

Anyway, I wish there was a gofmt in Python because at least, I'd drop all hopes of forging my own rules (silly junkies) and some basic clarity would be forced into our codebase.

I know there are beautifiers but when such things are enforced and not negotiable, it's just so much simpler and people just stop caring as well.



It's Python code and I find it uglier than some fairly large C++ project I used to work on.

I've always argued that if your team can't bother to even indent code properly than you have much bigger problems than any language formatting rules can solve.


One time we worked on some code, and one of the developers had the same habit: "It works, so why do I need to format it?"

We decided to make our build system run PEP over the code, resulting in a failure if PEP didn't pass.

It annoyed the hell out of him, but we quickly got the formatting up to a better standard.



My apologies, yes. Don't know why I missed the 8 off there.


I completely support enforced style -- it's part of what I love about Python and F#'s light mode -- but it has to be the right style.

I strongly believe that code should look like a screenplay, not a novel. More white space, in other words, is rarely a bad thing. Inline braces decrease white space and make unfamiliar code harder to scan, so to me they're Not Good.

Also wow, I didn't know it was even possible to write Python without spaces. Are we talking no spaces in arguments, like

    def func(arg1,arg2):
        print "Indented"
        return
or full-on no spaces?

    def func(arg1,arg2):
    print "Not indented"
    return
I thought the latter was prohibited.


Sorry, we are talking about that:

    def func(arg1,arg2):
        i=other_stuff(1,2,3,4,56,43,234+4*3)
        return i




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: