4 ms·
Python white space indentations adds some overhead when pasting code but overall I feel improves the code I write and the code I have to read. I think if it we
by parfe 15y ago
Python white space indentations adds some overhead when pasting code but overall I feel improves the code I write and the code I have to read. I think if it were possible to do multiline anonymous functions a lot of the feel of python would change and there would be a lot more function calling with nested anonymous blocks. I don't know if that would be an improvement or not, but I personally like my coworkers (and me) being forced to have a binding to the code they are writing in the block they are writing it in.
The adverse visceral reaction to white space (which I think is akin to the reaction to parens in lisp) appears to me to be people being unhappy with being "forced" to do something. These (for me) happen to be the same people who don't understand why the code they wrote in their personal (and ever fluid) style is no good to be added to our code base.
- berntb 15y agoInteresting. Do you have references to support that code blocks are bad? They are popular most everywhere else? (-: It sounds like a cripple claiming they don't need their missing body part. :-) The last paragraph is a straw man imho -- people have no business having a programming job if they can't use their team's code formatting rules. (If they work in a team of one, they still need to specify and follow coding/documentation standards.)
- parfe 15y ago>Do you have references to support that code blocks are bad? Which part of my post gave you the impression I was talking about anything other than direct personal experience? I made sure to be explicit about it. I even say I don't know if they would be good or bad, but gave a reason why I like python disallowing them. edit: I take exception to the idea that my personal opinion needs to have a "reference" which would boil down to the personal opinion of another random person on the internet who supports my position authoring a blog post that looks "sciencey". Opinions on language features does not produce scientific studies.
- berntb 15y ago>>I take exception to the idea that my personal opinion needs to have a "reference" Oh, private musings instead of an argument? Less interesting. :-)
- parfe 15y agoArgument? What was I arguing? In fact, what are you asking other than saying "my language is gooder than ur language!" In fact you haven't said that because you don't want to defend a position in a mythical argument I was putting forward. So instead you asked for a reference to an assertion I did not even make. I said I like that my coworkers need local bindings to code they pass. You asked for a reference. Well here it is! Some guy on the internet saying why python's lack of multiline anonymous functions is so good you should not only change coding styles but adapt his language over your language because his is obviously proven superior in every way, scientifically.[1] [1]http://news.ycombinator.com/item?id=3057283 http://news.ycombinator.com/item?id=3057283 Yes, ruby blocks are useful. Yes, lambdas let lisps do cool things. Python makes you name your blocks. It's a horror show. And to your straw man issue. Yes, we actually just terminate everyone on the spot who tries to commit code that doesn't follow pep8 to the letter. Even when it doesn't make sense for a line that isn't nicely split at 80 chars. And by terminate, I mean execute. ------- It's like any commentary on a language must be part of some epic language-war.
- berntb 15y ago>>Argument? What was I arguing? I read it as a possibly interesting new claim about programming languages. If you just wrote without making/arguing a position, sorry for commenting. And reading. Edit: That anonymous funs might not be good is totally new to me. I've never seen anything about it, but was willing to read. I hope you at least had fun flaming people... (z0r -- I didn't see a discussion in the article.)
- z0r 15y agoIf you had read the original post, you would have nothing to apologize for.
- gbog 15y ago> overhead when pasting code No sure I get what you mean. I pasted a lot of code in PHP and Python, and in both case you have to select the pasted block and adjust left or right according to the change of depth level. > people being unhappy with being "forced" to [indent] Well, then why the Hell would these people be happy to be forced to write { and } around their blocks? For me, there is one little annoyance with indent as syntax in Python, it is that it is harder for my editor (Vim) to let me jump from def to the end of the function, and the reverse. (Or there is a conf, a plugin I missed? I know about indent folding, but I just want % to behave like if I had curlies.)
- parfe 15y ago>I pasted a lot of code in PHP and Python, and in both case you have to select the pasted block and adjust left or right according to the change of depth level. Yes, you readjust the PHP for aesthetics. Not for correctness of execution. In vim, if I recall(emacs for a while now), =G auto formats bracketed code without issue. Pasting code, deleting enclosing block, adding an enclosing block, or highlighting a mismatched bracket (when formatting goes horribly wrong) can be handled automatically.
- gbog 15y ago> Yes, you readjust the PHP for aesthetics Here we differ. A code uncorrectly indented is wrong for me, and must be corrected right now. I don't care at all if it runs or not.
- parfe 15y agoif user_set_delete: logger.info("User set flag to delete file") delete_file() vs if($user_set_delete===True){ log("User set flag to delete file"); delete_file(); } "Correct" and "looks good" can have very different consequences. Acting like proper indentation for looks is on the same level as proper indentation for execution is ignoring the real dangers of improperly indented python. I know copying that php block will not change the execution, no matter how it is formatted vs copying python where I need to guarantee I've got it right. Hence "some overhead".