r/programming • • Sep 03 '17

wtfpython - a collection of interesting, subtle, and tricky Python snippets

https://github.com/satwikkansal/wtfpython
118 Upvotes

28 comments sorted by

View all comments

Show parent comments

0

u/[deleted] Sep 03 '17

[deleted]

14

u/nandryshak Sep 03 '17

This seems like a problem that is easily solved by using a properly configured editor.

-6

u/[deleted] Sep 03 '17

How so?

5

u/nandryshak Sep 03 '17

It's very hard for me to accidentally indent with 3 spaces. Pressing tab always inserts the amount of spaces needed for the next indentation level. Pressing backspace always removes spaces to go back a level.

For example, at 0 spaces, tab will insert 4. If I add 1 more by pressing spacebar once, then press tab or backspace, it will add or remove 3 or 1 spaces respectively.

2

u/[deleted] Sep 04 '17

Extremely complex behavior for something that is inherently supported by the text renderer via the tab character. Tabs will also automatically order according to column completely automatically, spaces will not. Spaces-for-tab is a cargo cult. An extremely popular one, but a cargo-cult nonetheless. I mean, how many people who defend spaces actually know the history of representing tabs as spaces? Because it used to be useful once upon a time, when people tended to be more prone to printing out code to paper on matrix printers. Hint : a long-forgotten era of programming.

0

u/nandryshak Sep 04 '17

What if I want to indent my Lisp with 2 spaces, Python with 4, and C with 8, and have it look the same for everyone else looking at my code? Not every editor can do this with tabs seamlessly, and even then some people might use different settings. Also how would you configure this in a browser or terminal?

2

u/[deleted] Sep 04 '17

What if I want to indent my Lisp with 2 spaces, Python with 4, and C with 8, and have it look the same for everyone else looking at my code?

The purpose of this being..? Sounds like you're reaching for an argument :P

Also how would you configure this in a browser or terminal?

Use a fixed-width, non-bitmapped font. We're not in the 80's anymore.

→ More replies (0)