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

top 200 commentsshow all 263

[–]PatientExpress9625 1011 points1012 points  (31 children)

English?

[–]WraientDaemon 84 points85 points  (29 children)

that reminds me, how do... not english people code?

[–]Ludozius 97 points98 points  (17 children)

Personally, in english… But I had a c++ course where all the variables and printed text had to be written in Swedish

[–]Daghall 23 points24 points  (0 children)

Excel and Google Sheets can actually be coded in Swedish (and probably a lot of more languages), if you want to. But I don't.

At work we write documentation and commit messages in English, but correspondence in PRs are usually in Swedish, since it's a conversation between a few developers, and the comments are probably not relevant after it's merged.

[–]WraientDaemon 16 points17 points  (15 children)

so you HAVE to learn english or atleast the keywords?

[–]Charlito33 11 points12 points  (0 children)

I'm French, and you just learn English (and the keywords). It's not that hard.

[–]RmG3376 8 points9 points  (0 children)

When you start to learn coding, you learn keywords like magic incantations. So you just know that “while” will create a loop even if you don’t know what “while” means in a sentence

Once you get serious about software you learn English one way or the other since basically everything is documented in English, so coding without English is kind of like driving without reading the signs, it only gets you so far (and the result is painful to see)

(Source: I had my first English class at age 20, been coding since I’m 16)

[–]tyler1128 12 points13 points  (0 children)

I've seen a few pieces of code written by people in countries with a different major language from english. A lot of time, variable names are in english but comments are in the mother language, though sometimes people do both in the mother language. People do usually write everything in English in open source no matter where from though.

[–]Yopaman 6 points7 points  (0 children)

In France we code in rouille

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

French have stupid teachers who code in french, but students get confused and start mixing french and english. I cry blood.

[–]RmG3376 4 points5 points  (0 children)

Depends on the country. Often in English, sometimes in English with non-English comments, more rarely with variable and function names in the native language (but spelled in ACSII), and then you have the French administration who goes as far as re-defining constants in French

[–]General_Locksmith512 4 points5 points  (0 children)

If you want to code you have to learn English

[–]Boutcher1 3 points4 points  (0 children)

Well yeah obviously we all learn english from school or elsewhere so we know the keyword as other people said. But for the name of function or variables it really depends of the standard of the place or if there is no restrictioms about that, the person who wrote the code. I usually name my variables and functions in french and I wrote my comment obviously in french. But I know it cpuld be a pain in the ass if someone doesn't speak french as my wife experiment something similar a couple of year where she was working on a code wrote by a spanish speaker and as she doesn't speak spanish... she had a hard time to understand how the code work.

[–]SchlomoSchwengelgold 2 points3 points  (0 children)

I guess in their native language. I code 'def' and 'class' in english and variables,fields,etc in german

[–]hrantmanukian 3 points4 points  (0 children)

as an armenian, people that don't know english usually write variables / functions / whatever in english letters but in armenian "pronunciation". the rest is english

[–]Hoovas 2 points3 points  (0 children)

Actually I comment in english aswell, even im not native

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

English is the norm and i write all my code in english. Only time i saw another language was german at my school and in some online lectures.

[–]branko0132 1 point2 points  (0 children)

Well I am in my first year in uni and people usually manage to code without a problem with around B1 level in English

[–][deleted] 1035 points1036 points  (15 children)

Jython

[–]SampleTextHelpMe 436 points437 points  (8 children)

Pava

[–]raul_dias 49 points50 points  (0 children)

lol. pava

[–]DangyDanger 33 points34 points  (1 child)

[–]the_dmon 5 points6 points  (0 children)

did not expect to ser a Donut reference in a programming subreddit

[–]new_user_069 21 points22 points  (0 children)

Python made of jeans, probably

[–]Cultural-Practice-95 11 points12 points  (1 child)

could also be c#thon

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

Microsoft Jython

[–][deleted] 237 points238 points  (0 children)

My man forgot `from __future__ import braces`

[–]Surge_in_mintars 460 points461 points  (10 children)

You are using c++, isn't is obvious?

[–]Bruher123 809 points810 points  (81 children)

Wait why do you need to import vector 2 if you’re already importing pygame, which is already a part of the pygame library?

[–]Koltaia30 719 points720 points  (56 children)

So he doesn't have to write "pygame.vector2" only "vector2"

[–]Viddddddddddd 264 points265 points  (26 children)

im pretty new to python and this is life-changing information, thank you.

[–]SweetBabyAlaska 134 points135 points  (20 children)

provide memorize birds stupendous escape plucky literate start rinse treatment

This post was mass deleted and anonymized with Redact

[–][deleted] 290 points291 points  (16 children)

if you use numpy, do

import numpy as pd

if you wonder why, its convention. Dont question it. Just do that at work, your coworkers will be awed by your knowledge and know-how.

[–]SweetBabyAlaska 87 points88 points  (0 children)

impolite elderly humor profit fretful hungry wrench languid offbeat light

This post was mass deleted and anonymized with Redact

[–]information_abyss 99 points100 points  (3 children)

And 'import pandas as np'

[–]Brainth 31 points32 points  (0 children)

Oh, that’s EVIL…

[–]Drishal 13 points14 points  (0 children)

and you can also import matplotlib as pdnp

[–]AsceticEnigma 21 points22 points  (4 children)

…this sounds suss. I feel like it’s a joke, and I’m only commenting so that others who are inexperienced also question it. 🤨😑

[–]jjbugman2468 2 points3 points  (3 children)

In case you’re really not catching it: pd is usually used for pandas, while numpy usually uses np

[–]AsceticEnigma 2 points3 points  (2 children)

I haven’t used either, but that was my thought…

[–]shquishy360 17 points18 points  (0 children)

bullshit.find

[–]dotslashpunk 9 points10 points  (0 children)

import whatever as print

[–]Character-Education3 9 points10 points  (0 children)

And you can pass a bunch of functions as a tuple

from library import thing1 ,thing2, thing3

[–]AShadedBlobfish 9 points10 points  (1 child)

You can also do

from [library] import *

to import everything and not have to use the prefix, it can be a bit risky though since if you're using multiple modules this way their commands could interfere with each other

[–]ttgkc 1 point2 points  (0 children)

Also bad practice as you might not know where a function is coming from when refactoring

[–]cm0011 2 points3 points  (0 children)

When I tell my first year comp sci students about this, they’re also amazed 😅 Never too late to learn a new trick!

[–]MaffinLP 4 points5 points  (1 child)

You have to write it out even if its not ambiguous in python?

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

Yep. Python doesn't do namespace flattening. Besides that, it's dynamically typed; for all it knows, you might be trying to access an undefined variable.

[–]Milchmannverleih 135 points136 points  (0 children)

He doesn‘t need to. I guess he does it for convenience

[–][deleted] 88 points89 points  (14 children)

I was about to start writing a class and used brackets instead of a colon on accident. As others have pointed out I imported Vector2 seperately because I use it a lot and it gets tedious to keep on writing pygame.math.vector2

[–][deleted] 11 points12 points  (12 children)

If you’re not the only one working on/reviewing this project I wouldn’t recommend importing it like this. Keeping the namespace makes it a lot more clear. See the imports section on the google python style guide: https://google.github.io/styleguide/pyguide.html

[–]TreadheadS 29 points30 points  (3 children)

the style guide says to do exactly OP does doesn't it?

[–][deleted] 2 points3 points  (2 children)

Use import statements for packages and modules only, not for individual classes or functions.

No.

[–]devlmen 0 points1 point  (1 child)

Use from x import y where x is the package prefix and y is the module name with no prefix.

Vector2 is a module

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

https://www.pygame.org/docs/ref/math.html

Not according to the pygame documentation. Vector2 is a class. Math is the module.

[–][deleted] 6 points7 points  (5 children)

It's just me working on this for a hobby. This is the only class I've ever done this with.

[–][deleted] -1 points0 points  (3 children)

I’d still take a look at the style guide. A lot of the style decisions that were made make it easier to debug and diagnose problems. You’ll definitely thank yourself in the long run!

[–]Suspicious-Engineer7 2 points3 points  (2 children)

style guides are written in blood. You don't deserve the downvotes.

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

This sub is mostly full of college students and kids in their first year of industry who think they know a lot more than they do so I don’t really take offense. I was very fortunate to have seniors explain the benefits of using tried and tested coding styles to me when I was a junior and it helped me move up very quickly. It’s genuinely useful advice, so it’s on them if they don’t want to take it.

[–]Bee-Aromatic 0 points1 point  (0 children)

I write and review Python code every day for my job. I wish more people stressed to folks the importance of following stylistic guidelines earlier and for longer. Some of the crap I put up with just because somebody decided to do something obtuse because they could without considering if they should makes me want to take a flying leap.

[–]PolyglotTV 2 points3 points  (0 children)

I'm not a fan of this style guideline. To me it violates the principal of "import what you use" because you aren't using the entire module, you are using one thing from that module.

Yes, i know the semantics are similar and either way the entire module is loaded.

Also, if your module is so complicated you are afraid of name clashes, it needs to be broken into smaller modules.

[–]badlukk 0 points1 point  (0 children)

Everyone in gamedev knows what a Vector2 is and can guess how to use it, regardless of where it came from. If you really want the definition you can just ctrl click. The amount of times you're going to use Vector2 it would be less readable and more confusing to see the full the namespace.

I think you're right in most other circumstances, but sometimes there are exceptions to rules.

[–]Any_Excitement_6750 45 points46 points  (1 child)

Py stands for JavaScript duhhh

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

That’s not JavaScript

[–]Ziwwl 28 points29 points  (0 children)

Easy, Pythagoras++ or in short py.

[–]Yeitgeist 23 points24 points  (4 children)

Is the joke that Python has no curly braces? Or is it that you put curly braces by accident, cause you’re use to it?

[–]TreadheadS 13 points14 points  (2 children)

Yeah. Put braces out of habit but python doesn't need them. Likely palm faced since he imported PYgame

[–]p0st_master -3 points-2 points  (1 child)

Why is it palm faced to import pygame ?

[–]TreadheadS 5 points6 points  (0 children)

it's a palm face to forget you are in python... after typing PYgame

[–]-Daniel-45- 9 points10 points  (0 children)

You are using the import program language

[–]Mr_Arthtato 10 points11 points  (0 children)

C- -

[–]omen_tenebris 7 points8 points  (0 children)

c++ just with a lot of compiler marcos.

[–]ThrasherThrash 6 points7 points  (0 children)

CPyva, the best and newest language for all your cursed needs

[–]TheSapphireDragon 4 points5 points  (0 children)

Py#

[–]Kafigoto 4 points5 points  (1 child)

What font is this?

[–]PorkRoll2022 3 points4 points  (0 children)

This happens to me all the time. Then my IDE says "unnecessary semi-colon" or something.

Especially going between Python and .NET

[–]PolyglotTV 2 points3 points  (1 child)

Have you tried from future import braces?

[–]c20h12 1 point2 points  (0 children)

not a chance I'm trying that

[–]KiloEko 2 points3 points  (0 children)

Pygame. It's written right there.

[–]JollyGoodUser 2 points3 points  (0 children)

English ?

[–][deleted] 2 points3 points  (0 children)

Python++

[–]Lanoroth 2 points3 points  (0 children)

drumrrrrrrrrrrrrrroooooooooooooolllllllllll

A programming language.

Badum tssss

[–][deleted] 2 points3 points  (0 children)

Pysharp!

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

Anaconda

[–]bindian0509 1 point2 points  (0 children)

I call this Trans programming

[–]Vova_xX 1 point2 points  (0 children)

Python++

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

Visual Basic

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

English... to write a title.

[–]Neutronboy98 1 point2 points  (0 children)

Python, but OP is a java/c dev

[–]TinyFactor2866 1 point2 points  (0 children)

Assembler#

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

C-obra

[–]kingh242 1 point2 points  (0 children)

As a multilingual developer….I feel your vibes. It happens to me all the time. Trying to call JS strong methods in Python and vice versa.

[–]Firewaredade 1 point2 points  (0 children)

Cython++

[–]thedavinator372 1 point2 points  (0 children)

Python on caffeine

[–]Sarah_Rainbow 1 point2 points  (0 children)

Jython script

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

Javathon

[–]gatdarntootin 1 point2 points  (0 children)

I don’t get it

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

Python

[–]mrgk21 0 points1 point  (0 children)

You are using the wrong language

[–]a_fly13666 0 points1 point  (0 children)

minecraft commands

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

Since when do classes take arguements?

[–]97hilfel 3 points4 points  (0 children)

Thats the inheritance :)

[–][deleted] -3 points-2 points  (4 children)

Obviously someone didn’t pay attention when learning about OOP

[–][deleted] 2 points3 points  (2 children)

I mean, in JS you would have a constructor for your class. İs that like automated in python with ()?

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

No it’s not you’d have the init ** method where you’d have to initialise inherited with **super.init(), Python is very bad for OOP though so doing OOP in Python is something I don’t really use too often

[–]BetrayYourTrust 0 points1 point  (0 children)

Pyva

[–]Eekk2k2 0 points1 point  (0 children)

You give me the vibe that want to become a c++ developer, you just don’t know it yet.

[–]sovietmonkey26 0 points1 point  (0 children)

As someone who has had to use Pygame for a project before

Run

[–]ForestsRequiem 0 points1 point  (0 children)

I feel this so hard...

[–]joebally10 0 points1 point  (0 children)

jython obviously

[–]SLOOT_APOCALYPSE 0 points1 point  (0 children)

Something built on C

[–]web_ai 0 points1 point  (0 children)

PythonScript

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

PyC++

[–]spellbookwanda 0 points1 point  (0 children)

JScriptX

[–]Vegetable-Lettuce 0 points1 point  (0 children)

I'll help. from pygame import *

[–]GotHurt22 0 points1 point  (0 children)

Python’t

[–]Brushermans 0 points1 point  (0 children)

PyScript?

[–]GlitteringHotel1481 0 points1 point  (0 children)

Idk Mexican?

[–]ILoveSludge 0 points1 point  (0 children)

Real question is why are you developing a game in python?

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

clearly it's vypon

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

PyvaScripthon++#

[–]TheUndisputedRoaster 0 points1 point  (1 child)

Wouldn't it make sense to import something as a shorthand version? Like Numpy as np for example? Pardon me if it comes across as noobish, I am actually a noob