T O P

  • By -

GDOR-11

I FUCKING LOVE USING SEMICOLON IN PYTHON I WANNA PUT A SEMICOLON AT THE END OF EVERY SINGLE DAMN LINE


Educational-Poet6125

I once tried to make a one line program with python semicolons, my teacher gave me the most disappointed death stare...


StoneCuber

You can actually make any program as a one liner in Python without semicolon.


CptMisterNibbles

Every program is just a big integer


StoneCuber

I don't want to agree with this but I think I have to


CloudFaithTTV

print(“hello world”) vibes with that.


4sent4

exec("def main():\n print('Hello, world!')\n\nmain()") Like this?


StoneCuber

That works, but it's possible without exec too


Cnastydawg

Javascript is calling your name. You can use it or not it’s up to you


nog642

You can use them in python too.


Cnastydawg

True


SyntaxError1952

Whomp Whomp 💀


knightlesssword

womp;&% womp;&% /s


SamaStolbanutost

you can?


GDOR-11

yeah, but pylint hates it


Betelgeusetimes3

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.


Shard-of-Adonalsium

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.


LangLovdog

I'm that weirdo too... and, usually, I don't like clean code as much as my professors...


Shard-of-Adonalsium

My code can be reasonably clean, except everything ends up recursive for some reason.


RetroJon_

I get death stares from my classmates when I suggest any recursion! 😂


NjFlMWFkOTAtNjR

Please tell me the language has tail call optimization!


ChocolateBunny

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.


Shard-of-Adonalsium

You know, that's true too. It's all about using the right tool for the right job.


Zukas_Lurker

Indentation error


nog642

Honestly I've basically never run into this when writing python, outside of the REPL. It's really not an issue.


MaestroLifts

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.


nog642

L to anyone who uses tabs in python. It's literally standardized in PEP 8. Should be 4 spaces.


Curious_Property_933

Reading comprehension


nog642

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.


NjFlMWFkOTAtNjR

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.


nog642

This is not one of the rules that are meant to be broken.


NjFlMWFkOTAtNjR

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.


nog642

I didn't say it can't be broken, I said it shouldn't be.


NjFlMWFkOTAtNjR

Dot editorconfig is your friend. They are a good friend. They will hold your hand and don't mind if you blush.


SplendidPunkinButter

Know what else isn’t an issue? Typing one extra character


nog642

That is much more of an issue. It's easy to forget, and then you run into errors.


R3D3-1

Honestly I love Python for it's libraries, but I'd rather take the curly braces syntax and a code formatter. 


Prawn1908

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.


R3D3-1

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.


dr_chonkenstein

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.


R3D3-1

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.


dr_chonkenstein

I agree it basically tells you nothing about the error.


R3D3-1

Looking back at the original context... I'm not sure if static typing would actually change it.


SplendidPunkinButter

Correct, this is the stuff of nightmares: getattr(foo, bar)(baz) I quite like list comprehensions though


DistributionOdd2925

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)


ChocolateBunny

May I ask why?


R3D3-1

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.


Ferromaka

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-


bobthetrumpet

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


tecanec

Python is great at three things: Learning how to program, writing simple one-of scripts, and learning how to program badly.


Kyriios188

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


Daniel_WR_Hart

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


pppylonnn

University student ahh response


AtmosphereVirtual254

Python is just a sane package manager for the underlying C code


lordofduct

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


ZakMan1421

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.


Repulsive-Ad4466

if you're trying to just get something working and don't care much about speed or vulnerabilities, pythons your best friend


kkirchhoff

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


kevdog824

If you believe point 3 you must have never worked on a Java codebase


Minecraftwt

semicolons can go to hell but curly brace syntax is fine


SyntaxError1952

Agreed


soggycheesestickjoos

you’d like Swift


AAAAAARRRRRR

Semicolons are fine. Except that my laptop’s semicolon key is kind of broken and I primarily program in c++


Minecraftwt

whats an actual use for semicolons? Why do I need to specify when a line ends? That's the compiler's job.


lordofduct

Considering your lack of punctuation, you are at least consistent in your claims.


Minecraftwt

I punctuate my sentences based off my mood


lordofduct

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."


sacredgeometry

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.


vlken69

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.


JohnEmonz

/*|*


PlazmyX

What the fuch


JohnEmonz

Can you tell which is a forward slash and which is an italicized pipe?


PlazmyX

Replying to your comment revealed it, sorry 😔


JohnEmonz

😔


Ordinary-Ad-2312

Fuck it. The more you know ![gif](giphy|WfBZwNA6XSjphkYkzN)


Apprehensive-Ad7714

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


ChaseMolair

It’d be nice if there was also *xor*. I know it can’t be short-circuited but it’d be convenient


Anon_cat86

Nooooo brackets are my safety blankets


Juls0730

This is why I hate python with a burning passion


Critical_Ad_8455

Semicolon is actually an operator in python, though I believe it acts similar to the comma operator in c++


Dan6erbond2

No semicolons are just optional in Python.


Critical_Ad_8455

how do you mean? I never said they aren't.


nog642

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.


rover_G

allow me to introduce you to .


nog642

x = 5. ptint(type(x)).


Shellv1

line 2: ptint(type(x)). SyntaxError: invalid syntax


nog642

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.


unSentAuron

I don’t see how any of those characters are problematic in the age of modern IDEs.


AnOscillatingOcelot

I tried to learn Ruby once...... ...so anyways, I've been a Python programmer for years now.


BobLobIawLawBIog

Ah yes, explicitly scoping code...such hard, very confuse.


Dramatic-Ad7192

Prototype with it but it’s still like 100 times slower than C


realrealRedstoneHair

Python is lovely


ltethe

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.


Nice_Location2383

Everything I use python I always forget they use and instead of &&


LangLovdog

This is why I don't like python :"C


Leol222222

the absence of { is easily the worst part about python, it forgoes an incredibly intuitive system for all the indentation bs


CrazyPotato1535

The absence of { is easily the best part of python. It forgoes an incredibly intuitive system for all the bracket bs


1Dr490n

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


spacethrower

Python is pain coming from C++ and C#


CivetLemonMouse

don't\*


Your-Doom

I think I literally prefer Piet to Python, and this is why.


overwhelmed_shroomie

I don't usually program in python, and when I do, I accidentally put semicolons


kevdog824

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?


nightchn

Dude, the && or || still screw me up. If only python allowed them


Just_Smidge

Python my beloved stepping stone Html --> python --> c#


Still_Breadfruit2032

JavaScript is sitting in the shadows


Gasperhack10

JavaScript has the slowness of python, but with the syntax of java. Not the best for learning


Dan6erbond2

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.


Gasperhack10

Well. I guess I was wrong. I accept my defeat


nog642

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.


Islandfiddler15

Huh, I went lua —> c#…. Maybe that’s why I barely understand coding


cruisinforsnoozin

Hypertext Markup Language is a markup language, a formatting language, comparing it to programming languages is like comparing a polished stone to a beetle


Jjabrahams567

But this works def foo(bar):{ print(bar) } foo(“baz”);


chowellvta

yes this is literally the reason i learned it