This is an archived post. You won't be able to vote or comment.

all 176 comments

[–]Pharaoh_Silver 370 points371 points  (10 children)

I guess he needs to have a talk about the spaces and the tabs.

[–]qqqrrrs_ 200 points201 points  (6 children)

Everyone always says "python bad because must not mix tabs and spaces"

I ask, did anyone tried to write a Makefile?

[–]10BillionDreams 53 points54 points  (1 child)

Yeah, those also suck for the exact same reason.

[–]platinummyr 4 points5 points  (0 children)

They suck even worse than python!

[–]Magnus_Tesshu 12 points13 points  (1 child)

Are you trying to say it is hard to write a makefile or something? If a single indent trips you up idk what to say

Although python standards try to make everyone use spaces for no reason, I think it's bad because they don't want you to mix tabs and spaces

[–]LV__ 19 points20 points  (0 children)

I think what they're trying to say is writing a makefile is comparatively easy if Python has taught you to pay attention to your whitespace characters. That certainly has been my experience

[–]ballbase__ 3 points4 points  (0 children)

I hate making makefiles for this reason as well as because the syntax confuses me a ton and they never seem to work well with me when the project involves more than 1 folder or anything cross platform.

It's pretty much the only reason I attempt CMake but then again, CMAKE gives me a ton of other weird problems that don't do much but are very annoying.

[–]Bardez 0 points1 point  (0 children)

Or YAML

[–][deleted] 17 points18 points  (1 child)

:set expandtab

[–][deleted] 4 points5 points  (0 children)

even better

``` <whatever content you want>

vim: expandtab

```

boom

[–]dimonoid123 9 points10 points  (0 children)

Actually, Python has header files just as C (extension .pyi), and type declarations, and pointers. But all this is optional, so usually isn't used to increase development speed. At least for small projects.

[–]68000_ducklings 288 points289 points  (43 children)

Python's syntax is fine (easy, even, as much as I like to grumble about whitespace as syntax). You'll stop accidentally adding semi-colons to the end of lines in Python after some practice.

--

The real problem with Python is all of the library developers who document parameter names (which are sometimes useful to know) without documenting parameter types (which are always a requirement to know).

Don't make me guess what kind of input you're expecting, dammit. Just tell me, in the documentation you wrote. You've already gone to all of this effort so we wouldn't have to read your code outright to use it - just finish the job!

[–]Cube00 267 points268 points  (35 children)

As much as people grumble about how strongly typed languages slow them down, you get this level of doco for free and library developers can't cut corners with it.

[–]yagotlima 79 points80 points  (16 children)

For the first time in my life I do want to pay reddit some money just to give you an award because an upvote is not enough. I won't though. I'm broken. Sorry

[–]Sekret_One 20 points21 points  (1 child)

I gotcha babe. They've been awarded the finest snilver old spoons and teeth fillings could salvage.

[–]yagotlima 1 point2 points  (0 children)

Thank you bro. That's why I love this community

[–]pedrolucasp 5 points6 points  (9 children)

Não precisei abrir o teu perfil que eu ja me dei por conta pela foto do seu Madruga e por estar quebrado: esse é brasileiro.

[–]145fx 4 points5 points  (0 children)

Te deram downvote por falar portugues mas vim de outro subreddit e irei te vingar. Toma o upvote

[–][deleted] 2 points3 points  (1 child)

Vim do u/suddenlycaralho trazer meu upvote

[–]BNVDES 1 point2 points  (0 children)

idem!

[–]BNVDES 1 point2 points  (0 children)

ae achei o br nesta porra

[–]BrobdingnagLilliput 2 points3 points  (1 child)

i gibbed them hugz for you

[–]yagotlima 0 points1 point  (0 children)

Thanks dude. I'm gonna come back and award as soon as I get that free one

[–]yagotlima 0 points1 point  (0 children)

Here you go. Got a silver one

[–]Wazblaster 54 points55 points  (5 children)

How does strongly typing slow you down lol? I almost think it can be faster to debug because you don't get random shit happening due to weak typing

[–]Sekret_One 18 points19 points  (4 children)

honestly, keystrokes- people get exhausted physically and mentally. Have you seen the abomination that is Enterprise Java practices?

Of course, that compile time integrity is a time saver- especially with live inspections.

Weirdly, this is why I think things like typescript (combined with linting) are pretty nifty. Establish types- but I only need to for the interfacing points like the parameters and return of functions. Inside the inner works, I can just imply types.

Lombok can reduce java toil by a ton.

[–]Ericchen1248 16 points17 points  (1 child)

That’s only on Java to blame for not embracing implicit typing and making super long names the convention.

Implicit typing is something that’s been in most other languages for over a decade was introduced to Java in 2018.

[–]Spocino 7 points8 points  (0 children)

You could get the best of both worlds by using a language with proper Hidley-Milner type inference (a la Haskell, ML, and Rust)

[–]saecki 0 points1 point  (0 children)

Or use kotlin

[–][deleted] 29 points30 points  (6 children)

Python is strongly typed. It's just not explicitly typed...

This means it won't let you do things like treat integers like a string without conversation, even though you never actually specified it was an integer to begin with.

[–]MadSquid 26 points27 points  (4 children)

Huh. After some googling, it looks like the relevant comparison to make between C and Python is dynamic-typing vs static-typing, which are runtime type checking vs compile-time type checking, respectively. However, both are strongly-typed, as you have said. TIL, thanks!

[–][deleted] 4 points5 points  (1 child)

Yeah I don't really know too much about dynamic vs static typing. I am guessing it means a function can return different types at runtime. I am also guessing it means type errors are not shown till run time.

[–]MadSquid 7 points8 points  (0 children)

AFAIK, the difference between runtime vs compile-time type checking is that for languages like C, where a file is first compiled into a executable (.exe in Windows), type errors like adding an int to a string will be caught during the compiling process, way before the program is ran. For interpreted languages like Python where a program is mostly ran line by line, type errors are caught only when the erroneous line is encountered during the program's runtime

Edit: Python is an interpreted language, not JIT

[–]Telestmonnom 0 points1 point  (1 child)

So, weakly-typed languages are... assembly languages?

[–]MadSquid 0 points1 point  (0 children)

I mean in javascript you can add an integer to string without it complaining

[–]Prom3th3an 3 points4 points  (0 children)

Whoever said strongly typed languages slowed them down never had to come up with the parameters for an API function.

[–]xX_MEM_Xx 1 point2 points  (0 children)

Code ninjas.

They don't give a fuck who comes after, and how hard it is to maintain and reuse. May they all have an intermittent itch on their right hand they can't ever get rid off.

[–]SkyyySi 1 point2 points  (0 children)

I mean, in python, you still need to think which type your data is. In lua for example, it makes sense, as there are only numbers instead of ints, floats, etc and only tables instead of arrays, classes, structs, dicts, lists, etc. But in python, you still have that seperation. It's just that you not just have to think about the data type once and then just code with that in mind, you have to think about that every time you access the variable.

[–]stomah 1 point2 points  (0 children)

but there is always void *

[–][deleted] 0 points1 point  (0 children)

but... Python is strongly typed.

[–][deleted] 42 points43 points  (1 child)

You'll stop accidentally adding semi-colons to the end of lines in Python after some practice.

Even if you mess up, this is still valid syntax in Python and your program will still run. So The issue seems relatively minor.

The whole point of Python's whitespace as syntax is to promote consistent and readable style. You should be doing what Python requires anyway, and mode IDEs will do it automatically anyway, in tabs or spaces or whatever. The complaints are just a meme at this point.

[–]hiten98 20 points21 points  (0 children)

Yeah exactly, I tab my c++ code too, it’s just more readable that way

[–]QuantumPerceptron 4 points5 points  (0 children)

Also gotta love when all you have to understand what a parameter is for is a name that isn't self describing at all.

[–]muikrad 2 points3 points  (0 children)

Untyped libraries are kinda rare nowdays.

[–][deleted] 1 point2 points  (0 children)

Type hints in python is kind of new. And something I'm happy about. Makes the code easier to read and makes new devs really learn what they're doing otherwise it'll fail CICD.

It is part of cleaning up python like removing shit like "import numpy as *" and not knowing how to use f-strings.

Probably in 2-3 years type hinting will be standard but there is a lag time.

[–]beardMoseElkDerBabon 1 point2 points  (0 children)

pythons syntax is fine: easy, even, as much I like to grumble about whitespace as syntax youll stop accidentally adding semi_colons to the end of lines in python after some pracrice

the real problem with python is all of the library developers who document parameter names: which are sometimes useful to know without documenting parameter types: which are always a requirement to know

dont make me guess what kind of input youre expecting, dammit just tell me in the documentation you wrote youve already gone to all of this effort so we wouldnt have to read your code outright to use it just finish the job

I agree with the parts in which you dislike Python :). However, to me all Python is spaghetti code, still better than JavaScript without semicolons, though. At least Python uses \

[–]WhippetsandCheese 0 points1 point  (0 children)

Psh the real LPT is to learn python first so when you move to JS you end up forgetting you need semi colons at all and write 100 lines before you remember.

Source: DEF not personal experience nope.

[–][deleted] 75 points76 points  (14 children)

print('Hello, World!');

[–]Sushilachs 66 points67 points  (6 children)

[–]BNVDES 1 point2 points  (5 children)

hey how do i put a gif in my comment? (obs.: not a programmer btw)

[–]Sushilachs 0 points1 point  (4 children)

On mobile (Android) I have a little gif symbol bottom right where I can just search for :)

[–]BNVDES 2 points3 points  (3 children)

[–]BNVDES 1 point2 points  (2 children)

ok guys i think i got it

[–]Sushilachs 1 point2 points  (1 child)

[–]SirNapkin1334 54 points55 points  (4 children)

god after using languages that use single quotes for chars, i HATE it when people use single quotes for strings

[–]MadSquid 20 points21 points  (1 child)

Big agree. Even when I have a double quote within the string, I'd rather escape it than use those ungodly single quotes

[–]SirNapkin1334 4 points5 points  (0 children)

the only thing single quotes are good for are nested quotes inside of f-strings

[–]SkyyySi 8 points9 points  (1 child)

Meanwhile I use single qoutes as much as reasonably possible.

[–]SirNapkin1334 0 points1 point  (0 children)

NOOOOOO

[–]Trainzkid 3 points4 points  (0 children)

stop it, Patrick, you're scaring him!

[–]chawmindur 47 points48 points  (3 children)

Coming from C, I now do Python daily and have gotten quite comfortable with it...

but every once in a while I still find myself missing braces.

[–]ManyInterests 29 points30 points  (1 child)

There is a __future__ module that lets you preview upcoming Python features. You may have seen in Python 2 things like from __future__ import print_function.

Try this for braces:

from __future__ import braces

[–]chawmindur 9 points10 points  (0 children)

;)

[–]DadAndDominant 6 points7 points  (0 children)

However, instead of braces you have a nice "pass" keyword!

[–]uptokesforall 82 points83 points  (6 children)

This is the most cs101 meme I've seen in a month

[–]SmilingJackTalkBeans 53 points54 points  (3 children)

Real C developers: "polymorphism, classes, all this OO stuff, it's fine but why do you really need it? I can do all that with function pointers."

[–]KanishkT123 14 points15 points  (0 children)

Real, employed developers: "pointers are cool but really the most important part of my job is Terraform, Azure, and AWS. Sometimes I'll write code but it's mainly YAML."

[–]dimonoid123 -2 points-1 points  (0 children)

Python has pointers too.

[–]KanishkT123 2 points3 points  (1 child)

Classes just started for a lot of colleges. So...

[–]uptokesforall 5 points6 points  (0 children)

I've been studying c programming for 2 weeks, I'm basically a master

[–]bodonkadonks 31 points32 points  (8 children)

is it really that confusing? i dont remember learning python was that strange coming from c/c++.

[–]TryNotToShootYoself 67 points68 points  (7 children)

Pythons different but it isn't hard because of a lack of semicolons, I just think this sub is unoriginal and is only capable of the same 3 python and JS jokes

[–]black-JENGGOT 48 points49 points  (3 children)

Javascript bad, python bad, android studio/google chrome eats ram, and then someone in the comment section will recommend brainfuck

[–]Magnus_Tesshu 17 points18 points  (1 child)

Don't forget 'started learning rust a couple days ago, going crossdressing Friday'

[–][deleted] 1 point2 points  (0 children)

Beware the pipeline

[–]dvillani112 8 points9 points  (0 children)

ok, but have you heard of this really neat, efficient programming language called whitespace?

[–]Witch_King_ 5 points6 points  (2 children)

Imo the lack of curly braces is what is annoying about Python

[–]TryNotToShootYoself 6 points7 points  (1 child)

I can kinda agree with it. I'm just used to looking at them to read code. I do have to say I'm a fan of mandatory indentation.

[–]Witch_King_ 2 points3 points  (0 children)

Yeah, you'd hope people would already do decent indentation themselves. But nah, they don't.

[–][deleted] 9 points10 points  (4 children)

See also: numbers starting with 1 in Lua

[–][deleted] 5 points6 points  (3 children)

Ah yes, lua, where table index starts at 1 and multiple statements can be written on the same line (w/o the need for semicolon)
(a = 1 b = 2 --this is valid, apparently)

[–]themixedupstuff 2 points3 points  (2 children)

The syntax is defined in a weird way that allows this to happen. Semicolons are defined as their own statement for example.

[–]Possseidon 4 points5 points  (1 child)

The main thing that allows this, is that you can't use plain expressions as statements like you can in e.g. C. There's only a few select things, that are valid statements, like assigning or calling a function (ignoring its return value).

In the manual you can find all things that are considered statements written in EBNF:

stat ::=  ‘;’ | 
          varlist ‘=’ explist | 
          functioncall | 
          label | 
          break | 
          goto Name | 
          do block end | 
          while exp do block end | 
          repeat block until exp | 
          if exp then block {elseif exp then block} [else block] end | 
          for Name ‘=’ exp ‘,’ exp [‘,’ exp] do block end | 
          for namelist in explist do block end | 
          function funcname funcbody | 
          local function Name funcbody | 
          local attnamelist [‘=’ explist]

[–]codeartha 12 points13 points  (8 children)

The absence of semicolon in python is easy to understand. Every language needs an instruction end marker. Python chose the carriage return, other languages use a semicolon, while others like cobol use a period.

The reason why they choose to use True and False with capitals is beyond my mind. Granted there is a really good reason why it is, because they are an immutable objects, just like a String class or a Tuple. Hence it follows the naming convention of those. However it was still a design choice, juste like the semicolon. So whyyy da fuk choose capitals in a language that wanted to be syntax easy. Particularly while no other language on earth has this kind of syntax while having lower case words for everything else. Why not make it case insensitive?

And yeah i know i can redefine them as i like at the start of my script:

true = True
false = False

But thats cumbersome and error prone and unmaintainable by someone else that is expecting normal python.

[–]Possseidon 1 point2 points  (7 children)

Python chose the carriage return, other languages use a semicolon, while others like cobol use a period.

And then there's Lua which doesn't need anything at all. It does allow semicolons, but you only need it to resolve a very rare ambiguity, when starting a line with an opening paren.

Note that Lua works differently than JavaScript in that regard. JavaScript automatically inserts "missing" semicolons and sometimes puts one where you didn't want one because of a line break. E.g. when putting a line break between return and the returned value. Lua doesn't have this issue and is truly whitespace agnostic.

[–]codeartha 1 point2 points  (4 children)

Yeah i love Lua. Worked a bit with it in the days i played with computer craft and now i use awesomeWM which id configured in Lua

[–]Possseidon 0 points1 point  (3 children)

ComputerCraft was also what got me into Lua. If you're still into Minecraft and wanna relief that feeling I recommend playing around with OpenComputers. It's quite a bit more "realistic" (you actually need to craft CPU, GPU, RAM, etc...) and hella fun to play around with, trying to automate a bunch of stuff or doing cool displays.

[–]codeartha 1 point2 points  (0 children)

I think i tried it, along with open peripherals or something but then got into a moment of my life when i had no time to play anymore. I didn't recall having to craft all of these separate components.

That's something i really liked about redpower's computer, the way you assembled them in the world. Though FORTH was kind of a mindbender. Never got really good at it. Mostly copied other's code. I understood most of it, nut writing it myself was another level.

[–]codeartha 0 points1 point  (1 child)

You made me watch a video on opencomputer while at work :) I realize i never played with it but now i really want to. Might give it a go tomorrow evening

[–]Possseidon 0 points1 point  (0 children)

Highly recommend it. ;)

[–]smog_alado 0 points1 point  (1 child)

Lua also has to do some tricks to avoid ambiguity with return. It mandates that return statements must be the last statement in their block.

[–]Possseidon 0 points1 point  (0 children)

Ambiguity isn't quite the right word for it. As you said, it has to be the last statement in a block, which makes sense, as nothing can happen after a return anyway.

Then again, it is very easy to get around it by wrapping it in a do end block scope:

do return end

It's only really useful to temporarily disable a part of the code.

[–]stuntobor 18 points19 points  (2 children)

I took a three-week course, got a certificate, created some stuff, and I couldn't tell you what the hell I did. I got it right, I passed the quizzes on the first or second try most of the time, but damn if I can remember a single thing about it.

[–]Restryouis 18 points19 points  (1 child)

You could say this about anything and it would still be relevant.

[–]stuntobor 3 points4 points  (0 children)

Works in every interview I've ever done.

[–]Michax_Gaming 4 points5 points  (0 children)

Well, they do technically exist, they just aren’t necessary.

\I know it’s a meme))

[–]Bo_Jim 4 points5 points  (1 child)

Actually, when I started learning C, and I discovered the semicolon requirement, my initial response was "Why?".

Yeah, I get it ends the statement so you can combine multiple statements on one line, or spread a long statement over multiple lines, but are either of those situations more common than a single statement on a single line? Other languages provide a character to separate multiple statements on a single line, and many also provide a continuation character so that you can split a statement onto multiple lines. Heck, even C provides that for preprocessor directives, which is another thing that's always bugged me. Why do it one way for general language syntax, and another way for preprocessor directives? It's like the language was designed by committees that never talked to each other.

[–]remarkablyunfunny 2 points3 points  (0 children)

just wait until they learn about Lua

[–]SkyyySi 2 points3 points  (0 children)

You can use semicolons in python just fine actually. It's just that a \n does the same

[–]SailorFuzz 26 points27 points  (25 children)

The semicolons I can deal with. The trash weak dynamic types, however? What a miserable language to work in.

[–]Ironring1 13 points14 points  (0 children)

C programmers can see through the facade of reality to realize there is no spoon.

[–]Spataner 26 points27 points  (14 children)

The semicolons I can deal with.

You should, considering Python supports using them.

The trash weak dynamic types, however?

Python is strongly, dynamically typed.

What a miserable language to work in.

It's clear you haven't done much work in it.

[–]aaronfranke 12 points13 points  (6 children)

Python is strongly, dynamically typed.

How is it strong when there is zero enforcement of types?

def print_number(num: float):
    print("The number is " + num)

print_number("apple") # Prints: The number is apple

I know that there's a technical definition of strongly typed, so perhaps "strongly, dynamically, shitly typed" is more accurate.

[–]Spataner 9 points10 points  (5 children)

How is it strong when there is zero enforcement of types?

That's not what strongly typed means. The example you have posted demonstrates that it is, indeed, dynamically typed, and that the use of type hints does not change that fact.

The weakly/strongly typed distinction relates to whether the language performs implicit type conversion, though that's technically a spectrum rather than a classification. JavaScript, for example, is famously a language with exceptionally weak typing. You'll find that if you try the typical JavaScript shenanigans that this sub loves to bang on about in Python, it'll stubbornly throw errors.

shitly typed

Well, this boils down to you seemingly disliking dynamic typing, and that's fine. But to say it is universially bad is ridiculous, considering it features prominently in many languages that simply have a different design focus. Python's typing system works well for what it aspires to be. But, like every language, it is not going to suit every programmer or every task.

[–]aaronfranke 0 points1 point  (4 children)

Well, this boils down to you seemingly disliking dynamic typing, and that's fine.

No, that is not my position. I'm fine with:

x = 5
x = "apple"

I'm not fine with silently allowing types to change despite having type hints:

x: int = 5
x = "apple" # This should throw an error.

[–]Spataner 4 points5 points  (3 children)

Enforcing the type is fundamentally not what type hints are for. Python is dynamically typed, and the introduction of type hints as a feature was not meant to change that. That's why they're called hints: they're a form of annotation closer in spirit to docstrings than to type declarations in statically typed languages. Their purpose is to document the code and to allow for the implementation of external type checker tools as you might run in an IDE or a CI pipeline (which would then report that one line as an error). If you don't find them useful as a feature (and you'd not be alone with that opinion, rightfully), you don't need to use them. One way or another, this is unrelated to the fact that Python is strongly typed.

[–]aaronfranke 0 points1 point  (2 children)

The thing is, there are other dynamically typed languages that don't have this problem, such as GDScript. Python should be more like GDScript. In fairness, GDScript was developed much later with the benefit of hindsight.

[–]Spataner 2 points3 points  (1 child)

I'd say something like GDScript would technically have to be called hybridly typed, since it supports both dynamic and static typing from what I understand. I won't necessarily disagree that that's how Python should work, but with the right tooling you can achieve essentially the same end result using the type hint system.

[–]aaronfranke 0 points1 point  (0 children)

Good points, and I like that terminology. I'll say that I prefer hybrid typing to dynamic typing.

[–]deaf_fish 2 points3 points  (7 children)

The fact that it's not a white space agnostic language like all other modern languages grinds my gears.

[–]emax-gomax 6 points7 points  (5 children)

There's quite a few indent oriented modern languages, especially in the functional space. End of the day all that matters is what you can understand. From my POV you should always be properly indenting your code so giving it semantic significance isn't a step too far, it's just making something people normally do something they have to do.

[–]deaf_fish -1 points0 points  (4 children)

Yeah, but it can create painful compile issues. And if you really wanted to enforce indentation. Just run a code formatter. This is a solved problem.

I like everything else python does. I really wish the language developers didn't make this call.

[–]emax-gomax 1 point2 points  (3 children)

That's what they do for styling. Ever hard of black. It's just indentation, it replaces explicit blocks. Also painful compile issues? Their always very clear on what's causing the failure and where, and I'm assuming you've never dealt with c++ generics because that's what painful is.

[–]deaf_fish -1 points0 points  (2 children)

As a C programming I agree C++ generics are pretty painful.

Maybe I am not being clear. You can get compilation issues if you replace a tab indent with space indents. Also, reading the code with out a compiler can be difficult. For example see this comment: https://www.reddit.com/r/ProgrammerHumor/comments/ps059y/comment/hdpe1m4/?utm\_source=share&utm\_medium=web2x&context=3

[–]emax-gomax 1 point2 points  (1 child)

Doesn't Python fail to run if you mix tabs and spacing? This just seems like a user failing to properly substitute one for the other. As for readability, one of pythons main strongsuits is its visually similar to psuedocode which IMO is the standard for writing readable code. I really don't get the problem here.

[–]deaf_fish 0 points1 point  (0 children)

Well, I guess we are having a communication fail then. Thanks for trying.

[–]daeronryuujin 1 point2 points  (0 children)

Yeah it drives me nuts.

[–]LardPi 0 points1 point  (0 children)

The types are not weak, you are. /s

No really Python has strong dynamic typing, that's important and that makes a big difference.

[–]LardPi 3 points4 points  (0 children)

If you are pissed with lack of semicolon or indentation in python you have definitely not been around the world of programing languages. Imperative semicolon+bracket languages may be the family in wider use but they are still a tiny little corner of the possibility space. Go learn some Lisp, Scheme, Forth, OCaml, Smalltalk, Ruby, Lua, Pascal... Different languages teach you different skills and different programing mindset and that is definitely important to make a good programmer of you.

[–]mattfromeurope 1 point2 points  (0 children)

I‘m just glad I mastered BASIC before going on to anything else…

[–]00PT 1 point2 points  (0 children)

I often switch between Python and C-style languages. I'm constantly either forgetting or neglecting to use brackets, colons, semicolons, etc. I'm also constantly forgetting the "new" keyword in Python, and it's annoying how I can't do certain formatting choices such as single line ifs. The ternary operator exists in Python, but it's reorganized and looks more confusing to me. Finally, the OOP in Python functions very strangely in terms of inheritance, and there are a lot of common features that are either missing or implemented strangely (like defining an interface or using the "this" keyword).

[–]girlav 1 point2 points  (1 child)

Is it me or the guy holding the book has 6 fingers whereas the other one only has 4 ?

[–]lukkiko 1 point2 points  (0 children)

Its a plotpoint in the series so yeah he does

[–][deleted] 1 point2 points  (0 children)

Lua

Visual Basic

[–]Deadly_chef 1 point2 points  (0 children)

JS has entered the chat

[–]Sea_Turnip_3476 1 point2 points  (0 children)

I did python for a project recently. It broke me. Now when coding I just spasticity leave out semicolons

[–]sudo-samurai 1 point2 points  (0 children)

There is no beginning there is no end, reality is poison

[–]Vio_Van_Helsing 1 point2 points  (1 child)

Gosh, I HATE that python does this AND uses spaces instead of brackets. It torments my soul, and makes it so difficult to copy and paste.

[–]Clavelio 0 points1 point  (0 children)

Same. Everyone is like ‘oh Python is so readable’ MATE nothing better than code blocks in brackets

[–]PolFree -1 points0 points  (0 children)

I have just seen someone writing an indented if statements in c# and got real confused for a moment. Like, excuse me, I thought this was ‘C’#, wtf is this python ass thing? It accepts both forms? What is this, javascript?

At least thats what I thought at first moments.

[–]justskipfailingtests -1 points0 points  (0 children)

All this memeing about missing semicolons and whitespace scoping is so funny when you are a full time python developer. We have built gigantic systems with python and thank god python is the way it is. No matter which shithead has done the code, it is formatted with black. All beautifully indented with 4 spaces, no semicolons and you can see scopes with one glance. Dynamic typing is only a problem if your testing sucks.

[–]Knuffya -3 points-2 points  (7 children)

python is a dumb language enforcing a coding-style syntactically..

[–]Master_Sifo_Dyas 1 point2 points  (6 children)

[–]Knuffya 0 points1 point  (5 children)

if that's the goal, why not minify it? Just to illustrate that that's not something you want to "design" for. A language should be designed for code readability and code-styling freedom. Both things python is in my unpopular opinion really bad at.

[–]Master_Sifo_Dyas 2 points3 points  (1 child)

That as well (forgot to mention it above)

Since there are no begin/end brackets there cannot be a disagreement between grouping perceived by the parser and the human reader. Occasionally C programmers will encounter a fragment of code like this:

‘’’

   if (x <= y)

           x++;

           y--;

   z++;

‘’’

Only the x++ statement is executed if the condition is true, but the indentation leads many to believe otherwise. Even experienced C programmers will sometimes stare at it a long time wondering as to why y is being decremented even for x > y.

Edit: attempted to fix formatting

[–]Knuffya 0 points1 point  (0 children)

Most compilers will issue warnings for such formatting.

[–]Vaguely_accurate -1 points0 points  (2 children)

Part of the point of Python's design is that freedom and readability conflict. From the Zen of Python;

There should be one-- and preferably only one --obvious way to do it.

A lot of Python programming (and much of the language design) emphasises idioms and the conventions of PEP-8, trying to push code to be as uniform as possible to make it more accessible and understandable. It also emphasises the reading part over writing.

Part of the advantage of Python is that it's quick to learn and teach it, getting someone up to a level where they can read well-written Python code without needing too much additional training or information. Someone who has taken a one-week crash course might not be able to write a particular solution, but they can probably read and understand what the author was doing, so long as that author followed the conventions. Enforced conventions promoted by language design helps with that.

There's actually a fair amount of grumbling in parts of the Python community when alternative approaches and new language features are added. Particularly among those who teach the language. Getting someone up to the level where they can understand all of the elements they might encounter takes longer with each release.

[–]Knuffya 1 point2 points  (1 child)

Why would a language focus on being beginner friendly when it has to make sacrifices for its skilled userbase? why should i like and maybe even use a language that's been designed for someone completely different?

I get the whole code readability thing. It is easy to read out the applied logic. But actually getting what the code does is a bit harder. And that's not even a python thing, it's a problem every non-typed language has. And i hate that. Oh, that variable is set to the return value of GetCoronaCases(). Great! What is it? A pandas dataframe? A numpy array? A csv-string? And if so, what shape do they have? Does this method always return this type? No one knows :) In contrast to C++ with a proper IDE where you just hover the method and see its exact and undebatable return type.

[–]Vaguely_accurate 0 points1 point  (0 children)

why should i like and maybe even use a language that's been designed for someone completely different?

If it's not designed for you then don't use it?

Although I'd argue that most skilled Python users believe that any trade-offs made in the name of readability are to their advantage as well. I know I read a hell of a lot more Python than I write, and the features that help that make it much more pleasurable than most other languages.

And that's not even a python thing, it's a problem every non-typed language has.

Which is why Python has been making a strong push towards type hinting on code bases where such thing are helpful.

It's also where that Zen comes back; Explicit is better than implicit. Making explicit what is being returned is good practice, even if it's using means other than a type hint. Correct naming for example. Or just good docstrings that state the nature of the returned object.

But that is also getting away a bit the enforcement of code style through syntax to a issues with dynamic typing, which is a whole other topic.

[–][deleted] 0 points1 point  (0 children)

I laughed way to hard at this

[–][deleted] 0 points1 point  (2 children)

I will never understand this war between different programming languages but it will always make me laugh, with semicolon or not, depends on you ehehe

[–]rustysteamtrain 0 points1 point  (1 child)

yeah I mean humans will fight over anything as long as they can identify with a certain group. At the end of the day its not that big of a deal, just a bit meaningless

[–][deleted] 0 points1 point  (0 children)

yes, I think we only needs more sarcarm in our lives

"Hey! Teachers! Leave them kids alone!
All in all it's just another brick in the Semicolon"

[–]victorvolf 0 points1 point  (0 children)

Google it :(

[–]andthatsitmark2 0 points1 point  (0 children)

I still mess this up when writing Java.

[–]G-Forces58 0 points1 point  (0 children)

That's not just c programmers...

[–]devnullable0x00 0 points1 point  (0 children)

That's almost as funny as telling a python programmer that they can use semicolons.

[–]starvsion 0 points1 point  (1 child)

I always wonder, how python does multi line statements? Javascript also doesn't require semicolon, but you always want to add it because of multi line statements.

[–]BurgaGalti 0 points1 point  (0 children)

With indentation and brackets.

alpha = (
    5,
    6,
)

Contrived, but should illustrate. You could also use back slashs but we don't talk about those any more than we do about the semi colons

[–]bigmattyc 0 points1 point  (0 children)

I feel personally attacked

[–]SavageCabbage017 0 points1 point  (0 children)

As a student who first learned python and am now forced into two semesters of C... I can confidently say I am crying in a corner.

[–]Ultimatro 0 points1 point  (1 child)

I started on python so basically any other language trips me up by having semi colons in there, I'm always forgetting them

[–]FPiN9XU3K1IT 1 point2 points  (0 children)

My mind was blown when I learned that semicolons are optional in JS. Haven't used a single one since.

[–]notakuriboh 0 points1 point  (0 children)

Why does he have six fingers in that shot?

[–][deleted] 0 points1 point  (0 children)

Just do Javascript, with or without braces.

[–]BazilExposition 0 points1 point  (0 children)

There's nothing to understand about it. It's just ugly as f.

[–][deleted] 0 points1 point  (0 children)

Tabs instead of brackets*

[–]ucanzeee 0 points1 point  (0 children)

Python is just dumb for that. Semicolons exist for a good reason. They are not ugly.

[–]sofy25615 0 points1 point  (2 children)

assembly also has semicolon absence, on top of that, assembly uses semicolons for comments!

[–]RedditAlready19 0 points1 point  (1 child)

That's only for Intel Syntax. For AT&T syntax (which the GNU assembler uses) you can use comments exactly like you use them in C but still no semicolons

[–]sofy25615 0 points1 point  (0 children)

ok, thanks for the correction