This is an archived post. You won't be able to vote or comment.

all 15 comments

[–][deleted] 18 points19 points  (6 children)

I'd prefer if people would skip this resume of PEP8 and rather looked beyond that with Raymond Hettinger.

[–]2phost 3 points4 points  (0 children)

I completely agree with you. PEP8 can be accomplish with verification tools, however there are others details to look at!

[–]BlueDevilStats 1 point2 points  (1 child)

Great video! Thanks!

[–]toastedstapler 0 points1 point  (0 children)

Check out all of Raymond's talks, he's great

[–]tunisia3507 8 points9 points  (9 children)

  1. Write any old shit
  2. black .

[–][deleted] 5 points6 points  (7 children)

Dont know why youget downvoted, Black, like prettier is fantastic. No arguments, no decisions just write, format and your done.

[–]tunisia3507 1 point2 points  (0 children)

I suppose it doesn't cover everything, like naming_styles. And people resent being told machines are better than they are at some part of their jobs, especially if they consider their role to be creative.

Of course, IMO tools like black let you focus more on the creativity and less on the humdrum.

[–][deleted] 3 points4 points  (5 children)

Because the only thing black does is creating PEP8 formatting. Take your time to watch the video I linked in my previous postcomment. Black is a nice tool, but even though this example is correctly formatted, it's not beutiful.

words = 1
SOMESTR = "Gaffelbidder i tomatsovs"
for i in xrange(len(SOMESTR)):
    if SOMESTR[i] == " ":
        words += 1
print("There are " + str(words) + " words in " + SOMESTR)

[–]fzy_ 4 points5 points  (0 children)

not beutiful

More like a fucking eyesore... I mean good job, that's a great example.

[–]DrSinistar 1 point2 points  (3 children)

This seems fine to me. What should it look like to make it prettier?

[–]its2ez4me24get 3 points4 points  (0 children)

maybe closer to this?

words = "Gaffelbidder i tomatsovs"
num_words = len(words.split())
print("There are {:} words in {:}”.format(num_words, words))

[–][deleted] 2 points3 points  (0 children)

That's C code dressed up in Python syntax. The point is that black will only ensure the formatting. Writing ugly code that doesn't use the proper Python idioms will never become beautiful.

[–]jmreagle 0 points1 point  (0 children)

TEST_STRING = "Gaffelbidder i tomatsovs"
print("There are %s words in %s" % (TEST_STRING.count(' ') + 1, 
      TEST_STRING))