3 ms·
> Particularly the lack of braces Since most of my professional experience is with C like syntax languages, I don't get how the lack of braces is an advantages
by reallydontask 7y ago
> Particularly the lack of braces
Since most of my professional experience is with C like syntax languages, I don't get how the lack of braces is an advantages, quite the opposite in my limited experience with Python.
Braces define scope unequivocally, they are easy to visually parse and don't care whether you are using tabs or spaces or even if you, loud gasp, mix them. Furthermore, you can copy and paste, say for loop from a method to another method and it will work. In Python you might have to faff about with spaces (I'm sure there must be IDEs that solve this problem but it was no fun on vim or even notepad++)
- retube 7y agoAbsolutely agree. maybe its just cos I am coming from languages with braces (java) but yeah I find the lack of braces + whitespace having meaning (tabs versus spaces for example) _incredibly_ frustrating I also don't like the fact it is dynamically typed. It makes reading soure code so much harder. E.g What is the type of this thing that is being passed as a function arg?
- reallydontask 7y ago> I also don't like the fact it is dynamically typed. It makes reading soure code so much harder. E.g What is the type of this thing that is being passed as a function arg? I didn't want to get into that as it always seems to open a massive can of worms but agree 100% with you. I need all the help I can get when developing, to throw away all the type checking that the compiler does before runtime seems like developing with a hand tied behind one's back, but each to their own, far be it from me to try to convince somebody that they should switch languages: if Python works for you, then great, keep using it.
- abricot 7y agoTwo things: 1. For people not used to do programming, braces in text are usually significant - having them everywhere, and even start and end on different lines, are confusing. 2. For people not using standard US keyboard braces are often an SHIFT or ALT command, that makes it wildly different to program uninterrupted.
- reallydontask 7y ago> 2. For people not using standard US keyboard braces are often an SHIFT or ALT command, that makes it wildly different to program uninterrupted. I really depends on what you mean by wildly,but I've never programmed in a US keyboard (I use UK or Spanish) and it doesn't seem to be a big issue for me, clearly YMMV
- read_if_gay_ 7y ago> Braces define scope unequivocally So does whitespace, otherwise Python wouldn’t work as a programming language > they are easy to visually parse only if you indent properly > Furthermore, you can copy and paste, say for loop from a method to another method and it will work. In Python you might have to faff about with spaces (I'm sure there must be IDEs that solve this problem but it was no fun on vim or even notepad++) Shift+V } < or > Hit . as often as needed Too difficult? Not to mention you will run into exactly the same problem when copy pasting C unless you like randomly indented code
- reallydontask 7y agoIf I mix and match spaces and tabs, Python will not work and you cannot tell them apart ,it's a bit more subttle than this, but you get the idea (should you wish to). There is no such issue with braces. This is what i meant. As for formatting, you can use ide shorcuts to format your pasted code but it will run fine even if not formatted, not the same for Python, where it will not run.
- deleted 7y ago[deleted]
- read_if_gay_ 7y ago> There is no such issue with braces That is true, but mixing spaces and tabs is a contrived example. Literally nobody actually does that. Same for the point about formatting, I think. The average python dev probably spends about as much time reformatting pasted code as the average C dev spends typing braces. I guess my point is just I think you subjectively dislike Python’s syntax (which is fine) but are trying to make objective justifications for that which seem really far fetched. Why not just say you don’t like it?
- reallydontask 7y ago> That is true, but mixing spaces and tabs is a contrived example. Literally nobody actually does that. Contrived or not this has happened to me when copying and pasting, but I take your point that people won't mix and match. > I guess my point is just I think you subjectively dislike Python’s syntax (which is fine) but are trying to make objective justifications for that which seem really far fetched. Why not just say you don’t like it? While the issues I encountered might seem contrived and far fetched to you, they have happened to me, granted I don't do Python professionally. As I said on first comment, I don't like it because of the reasons I mentioned, some are factual,e.g. indentation when copy and pasting can mean that the script/program won't run, some are opinion-based, e.g. they [braces] are easy to visually parse.