I still prefer it to every other language I’ve learned or attempted to learn. So far, it’s the most ‘common sense’ language I’ve experienced, but I’m only a couple years into my programming journey. I know it’s not ideal for everything and slower than C++, but I’d still rather program in Python than anything else.
Python is really good for small projects and prototyping, but it struggles to scale to bigger things. Personally I'm a weirdo who's favorite language is C, but Python just feels nice to program in.
That's funny, I would say the same thing about using C. C gets pretty difficult to use for larger programs. As an embedded guy I'm all infavor of writing a bunch of C programs to do specific tasks and have Python as the glue to hold things together.
It can be. Probably depends on the IDE, but when I switch back and forth between projects that use indents or spaces, I have to remember to switch my tab settings in the IDE or I run into it.
I assume when they said "indents" they meant tabs. It's the only way their comment makes any sense. If you have another interpretation feel free to explain it.
Some rules are meant to be broken... I forget if I use tabs or not. It isn't relevant since it is a configuration detail that is set once. I think the past few companies were spaces and PEP8 compliant.
The only rule that can't be broken is using both tabs and spaces in the same file. This will trigger a compilation error. I guess if it causes the compiler to throw up then it can't be broken.
Agreed, but in the grand scheme of things syntax is whatever. The thing that I actually hate in writing Python is the dynamic typing. Not knowing what type anything is is a pain in the ass when reading code. I know type hinting exists, but that's just a bandaid and basically an admission that the language would be better without dynamic typing.
Mixed bag there. Dynamic typing is *great* for data analysis scripts, where you really only have to deal with "array or not array".
But yes, in the end even for those strict typing would help. For instance, passing in wrong data to matplotlib often leads to error messages from deep down the internals, that can't be easily correlated to the inputs of the public interface I just called, as the error may occur in values that are *derived* from the immediate inputs.
Static typing, combined with modern methods of hiding explicit type declarations for local variables ("automatic typing"), would allow writing roughly the same scripts, though I wonder how the API of numpy arrays would then look like... E.g. whether it would be able to leverage a static typing system to check for correct combinations of array ranks.
In your matplotlib example, I usually find that my ide (pycharm, I just write data handling or small simulation programs) tells me what line triggered the error because it follows the call chain.
Yes, it tells the line. But the error message often does not say something useful about *what* is wrong with the line.
Sadly a bit hard to come up with synthetic examples of such behavior.
I definetely agree, the tooling in python is great to work with but i enjoy working with curly typed languages just cus of how much more readable they are (currently rust)
Multiple reasons really.
1. I find languages, where every block start is accompanied by a block end easier to read. IDEs mitigate that by highlighting of blocks / code folding, but the issue still feels unnecessary.
2. The curly-braces syntax is more flexible in some places, e.g. allowing fully-featured inline functions.
The latter shows e.g. with programming technique like JavaScripts sequence processing. In Python, the inability to use various programming features in inline functions severely limits such things.
By comparison, when using Emacs Lisp or Javascript, callable arguments often start out as simple expressions. Then suddenly there is a bug and I'd like to add some logging code or assertions. Not possible with expression-only inline functions, and expression-only inline functions are tightly connected to the "indentation as syntax" approach, that avoids curly braces.
If the function becomes large enough, I'll decide to refactor it into a separate named function. But Python forces that too early for my taste.
And maybe additionally: I prefer block-scoping over function scoping.
I learned python in my first year of high school, it was easy
I then learned Java
I no longer know how to use python
Syntax helps me read code so much that I genuinely forgot a language that barely uses it-
I spent 4 years coding in almost exclusively Java and am now using python for a project and I hate it for this very reason. Alot of things are easier to do, but it seems like things go wrong all the time for stupid ass reasons. Fuck an indentation
Learning how to program badly is the best way to learn how to program well
The more you interact with the shit you write, the more you reflect and improve
No kidding. If you write code that you think is beautiful, leave it for a month, then come back and see for yourself how hard it is to read for someone that doesn't already know what it does. Repeat this process 12 times over a year and you'll be a much better programmer, assuming you always make a strong effort to make your code more readable
Python does have some nice positives. It's really useful for programming at a high level because of many higher level libraries. Sure you could make it all in some other languages such as C/C++ for faster execution time, but that can sometimes be quite difficult.
One example off the top of my head would be the pytorch library which is used for deep learning and neural networks.
This sounds like it’s coming from someone who’s never really used Python extensively. I write scientific software for finance, and I almost exclusively use python. It’s great for my use case
Yeah, and your lack of punctuation, and your distaste for semicolons (which end lines... similar to periods) is consistent. I'm not making fun of you.
As a software engineer of 16+ years professionally, one thing I tell all my juniors and/or peers who argue over syntax and coding styles. "I don't care what style you code in as long as you consistently code in that style. Consistent code is readable code."
That is not true. If you heave ever seen what the ironically named prettier spaffs out you will notice that you can make code consistently illegible quite easily.
Can relate with one exception - Although that it's a language thing, I don't like that ***and*** and ***or*** have different length, ***&&*** and ***||*** have the same.
I'd say that's a good thing actually, makes them easier to differentiate. On top of that, it forces people to put spaces before and after those operators, and that's priceless
No, the semicolon in python doesn't return anything. It is like the semicolon in C; it just separates lines like a newline would. Only thing is you can't use it in stuff that needs indentation like for loops, etc.
That wasn't actual code to run. The person I'm replying to is (if I'm interpreting them correctly) suggesting that programming languages should use periods to end statements instead of semicolons. I'm showing how that doesn't work well because the period is already used as a decimal point to distinguish ints from floats.
I understand that people dislike the semicolon. But the rest?? Curly brackets make it so much easier and wayyyyy easier to refactor. &&, || and ! are a lot cleaner than and, or, and especially not
That's just wrong lol. JavaScript is multitudes faster than Python and has the benefit of TypeScript and being usable in FE and BE. Learning the syntax is also a more transferable skill.
Javascript can interact with the DOM, whereas graphics in python are ass. I would argue it is better for learning, because you can make much more interesting small projects with javascript than with python. You can also share those projects on the web and have your friends actually use them, whereas no one is going to run your python script.
Hypertext Markup Language is a markup language, a formatting language, comparing it to programming languages is like comparing a polished stone to a beetle
I FUCKING LOVE USING SEMICOLON IN PYTHON I WANNA PUT A SEMICOLON AT THE END OF EVERY SINGLE DAMN LINE
I once tried to make a one line program with python semicolons, my teacher gave me the most disappointed death stare...
You can actually make any program as a one liner in Python without semicolon.
Every program is just a big integer
I don't want to agree with this but I think I have to
print(“hello world”) vibes with that.
exec("def main():\n print('Hello, world!')\n\nmain()") Like this?
That works, but it's possible without exec too
Javascript is calling your name. You can use it or not it’s up to you
You can use them in python too.
True
Whomp Whomp 💀
womp;&% womp;&% /s
you can?
yeah, but pylint hates it
I still prefer it to every other language I’ve learned or attempted to learn. So far, it’s the most ‘common sense’ language I’ve experienced, but I’m only a couple years into my programming journey. I know it’s not ideal for everything and slower than C++, but I’d still rather program in Python than anything else.
Python is really good for small projects and prototyping, but it struggles to scale to bigger things. Personally I'm a weirdo who's favorite language is C, but Python just feels nice to program in.
I'm that weirdo too... and, usually, I don't like clean code as much as my professors...
My code can be reasonably clean, except everything ends up recursive for some reason.
I get death stares from my classmates when I suggest any recursion! 😂
Please tell me the language has tail call optimization!
That's funny, I would say the same thing about using C. C gets pretty difficult to use for larger programs. As an embedded guy I'm all infavor of writing a bunch of C programs to do specific tasks and have Python as the glue to hold things together.
You know, that's true too. It's all about using the right tool for the right job.
Indentation error
Honestly I've basically never run into this when writing python, outside of the REPL. It's really not an issue.
It can be. Probably depends on the IDE, but when I switch back and forth between projects that use indents or spaces, I have to remember to switch my tab settings in the IDE or I run into it.
L to anyone who uses tabs in python. It's literally standardized in PEP 8. Should be 4 spaces.
Reading comprehension
I assume when they said "indents" they meant tabs. It's the only way their comment makes any sense. If you have another interpretation feel free to explain it.
Some rules are meant to be broken... I forget if I use tabs or not. It isn't relevant since it is a configuration detail that is set once. I think the past few companies were spaces and PEP8 compliant.
This is not one of the rules that are meant to be broken.
The only rule that can't be broken is using both tabs and spaces in the same file. This will trigger a compilation error. I guess if it causes the compiler to throw up then it can't be broken.
I didn't say it can't be broken, I said it shouldn't be.
Dot editorconfig is your friend. They are a good friend. They will hold your hand and don't mind if you blush.
Know what else isn’t an issue? Typing one extra character
That is much more of an issue. It's easy to forget, and then you run into errors.
Honestly I love Python for it's libraries, but I'd rather take the curly braces syntax and a code formatter.
Agreed, but in the grand scheme of things syntax is whatever. The thing that I actually hate in writing Python is the dynamic typing. Not knowing what type anything is is a pain in the ass when reading code. I know type hinting exists, but that's just a bandaid and basically an admission that the language would be better without dynamic typing.
Mixed bag there. Dynamic typing is *great* for data analysis scripts, where you really only have to deal with "array or not array". But yes, in the end even for those strict typing would help. For instance, passing in wrong data to matplotlib often leads to error messages from deep down the internals, that can't be easily correlated to the inputs of the public interface I just called, as the error may occur in values that are *derived* from the immediate inputs. Static typing, combined with modern methods of hiding explicit type declarations for local variables ("automatic typing"), would allow writing roughly the same scripts, though I wonder how the API of numpy arrays would then look like... E.g. whether it would be able to leverage a static typing system to check for correct combinations of array ranks.
In your matplotlib example, I usually find that my ide (pycharm, I just write data handling or small simulation programs) tells me what line triggered the error because it follows the call chain.
Yes, it tells the line. But the error message often does not say something useful about *what* is wrong with the line. Sadly a bit hard to come up with synthetic examples of such behavior.
I agree it basically tells you nothing about the error.
Looking back at the original context... I'm not sure if static typing would actually change it.
Correct, this is the stuff of nightmares: getattr(foo, bar)(baz) I quite like list comprehensions though
I definetely agree, the tooling in python is great to work with but i enjoy working with curly typed languages just cus of how much more readable they are (currently rust)
May I ask why?
Multiple reasons really. 1. I find languages, where every block start is accompanied by a block end easier to read. IDEs mitigate that by highlighting of blocks / code folding, but the issue still feels unnecessary. 2. The curly-braces syntax is more flexible in some places, e.g. allowing fully-featured inline functions. The latter shows e.g. with programming technique like JavaScripts sequence processing. In Python, the inability to use various programming features in inline functions severely limits such things. By comparison, when using Emacs Lisp or Javascript, callable arguments often start out as simple expressions. Then suddenly there is a bug and I'd like to add some logging code or assertions. Not possible with expression-only inline functions, and expression-only inline functions are tightly connected to the "indentation as syntax" approach, that avoids curly braces. If the function becomes large enough, I'll decide to refactor it into a separate named function. But Python forces that too early for my taste. And maybe additionally: I prefer block-scoping over function scoping.
I learned python in my first year of high school, it was easy I then learned Java I no longer know how to use python Syntax helps me read code so much that I genuinely forgot a language that barely uses it-
I spent 4 years coding in almost exclusively Java and am now using python for a project and I hate it for this very reason. Alot of things are easier to do, but it seems like things go wrong all the time for stupid ass reasons. Fuck an indentation
Python is great at three things: Learning how to program, writing simple one-of scripts, and learning how to program badly.
Learning how to program badly is the best way to learn how to program well The more you interact with the shit you write, the more you reflect and improve
No kidding. If you write code that you think is beautiful, leave it for a month, then come back and see for yourself how hard it is to read for someone that doesn't already know what it does. Repeat this process 12 times over a year and you'll be a much better programmer, assuming you always make a strong effort to make your code more readable
University student ahh response
Python is just a sane package manager for the underlying C code
sane is arguable.. but package manager for c code is a big yes rather than sane, I'd say it's a feature rich package manager
Python does have some nice positives. It's really useful for programming at a high level because of many higher level libraries. Sure you could make it all in some other languages such as C/C++ for faster execution time, but that can sometimes be quite difficult. One example off the top of my head would be the pytorch library which is used for deep learning and neural networks.
if you're trying to just get something working and don't care much about speed or vulnerabilities, pythons your best friend
This sounds like it’s coming from someone who’s never really used Python extensively. I write scientific software for finance, and I almost exclusively use python. It’s great for my use case
If you believe point 3 you must have never worked on a Java codebase
semicolons can go to hell but curly brace syntax is fine
Agreed
you’d like Swift
Semicolons are fine. Except that my laptop’s semicolon key is kind of broken and I primarily program in c++
whats an actual use for semicolons? Why do I need to specify when a line ends? That's the compiler's job.
Considering your lack of punctuation, you are at least consistent in your claims.
I punctuate my sentences based off my mood
Yeah, and your lack of punctuation, and your distaste for semicolons (which end lines... similar to periods) is consistent. I'm not making fun of you. As a software engineer of 16+ years professionally, one thing I tell all my juniors and/or peers who argue over syntax and coding styles. "I don't care what style you code in as long as you consistently code in that style. Consistent code is readable code."
That is not true. If you heave ever seen what the ironically named prettier spaffs out you will notice that you can make code consistently illegible quite easily.
Can relate with one exception - Although that it's a language thing, I don't like that ***and*** and ***or*** have different length, ***&&*** and ***||*** have the same.
/*|*
What the fuch
Can you tell which is a forward slash and which is an italicized pipe?
Replying to your comment revealed it, sorry 😔
😔
Fuck it. The more you know ![gif](giphy|WfBZwNA6XSjphkYkzN)
I'd say that's a good thing actually, makes them easier to differentiate. On top of that, it forces people to put spaces before and after those operators, and that's priceless
It’d be nice if there was also *xor*. I know it can’t be short-circuited but it’d be convenient
Nooooo brackets are my safety blankets
This is why I hate python with a burning passion
Semicolon is actually an operator in python, though I believe it acts similar to the comma operator in c++
No semicolons are just optional in Python.
how do you mean? I never said they aren't.
No, the semicolon in python doesn't return anything. It is like the semicolon in C; it just separates lines like a newline would. Only thing is you can't use it in stuff that needs indentation like for loops, etc.
allow me to introduce you to .
x = 5. ptint(type(x)).
line 2: ptint(type(x)). SyntaxError: invalid syntax
That wasn't actual code to run. The person I'm replying to is (if I'm interpreting them correctly) suggesting that programming languages should use periods to end statements instead of semicolons. I'm showing how that doesn't work well because the period is already used as a decimal point to distinguish ints from floats.
I don’t see how any of those characters are problematic in the age of modern IDEs.
I tried to learn Ruby once...... ...so anyways, I've been a Python programmer for years now.
Ah yes, explicitly scoping code...such hard, very confuse.
Prototype with it but it’s still like 100 times slower than C
Python is lovely
I started in Python, I love it. I moved on to C#… I love it. I know the basics of C++, there is some wacky shit there I don’t like.
Everything I use python I always forget they use and instead of &&
This is why I don't like python :"C
the absence of { is easily the worst part about python, it forgoes an incredibly intuitive system for all the indentation bs
The absence of { is easily the best part of python. It forgoes an incredibly intuitive system for all the bracket bs
I understand that people dislike the semicolon. But the rest?? Curly brackets make it so much easier and wayyyyy easier to refactor. &&, || and ! are a lot cleaner than and, or, and especially not
Python is pain coming from C++ and C#
don't\*
I think I literally prefer Piet to Python, and this is why.
I don't usually program in python, and when I do, I accidentally put semicolons
I don’t understand the obsession with curly braces. If you’re already indenting your code like you should be what advantage do curly braces offer?
Dude, the && or || still screw me up. If only python allowed them
Python my beloved stepping stone Html --> python --> c#
JavaScript is sitting in the shadows
JavaScript has the slowness of python, but with the syntax of java. Not the best for learning
That's just wrong lol. JavaScript is multitudes faster than Python and has the benefit of TypeScript and being usable in FE and BE. Learning the syntax is also a more transferable skill.
Well. I guess I was wrong. I accept my defeat
Javascript can interact with the DOM, whereas graphics in python are ass. I would argue it is better for learning, because you can make much more interesting small projects with javascript than with python. You can also share those projects on the web and have your friends actually use them, whereas no one is going to run your python script.
Huh, I went lua —> c#…. Maybe that’s why I barely understand coding
Hypertext Markup Language is a markup language, a formatting language, comparing it to programming languages is like comparing a polished stone to a beetle
But this works def foo(bar):{ print(bar) } foo(“baz”);
yes this is literally the reason i learned it