I suck at variable naming, always use a, b, c, d...... What should I do guys ?

I suck at variable naming, always use a, b, c, d...... What should I do guys ?

When using iterators, just use i, j, k, l, people will understand they're iterators and don't have a specific meaning.

Give them actual names that describe what they are doing or what they are used for

Give it a name based on the purpose

also do what said

I like to name my variables such that the control flow should be understandable from an outsider point of view. I should be able to come back at any time, look at the code, and immediately know what's happening.

>pajeet coding skills

#!/usr/env python
# function for printing OP is a faggot
def opPrint():
message = "OP is a Faggot"
return message
print opPrint()

Name your variables after their purpose/use.

Throw-away variables like iteratators can typically use single-character names.
Conventionally, it starts with i and increases as necessary.

However, I would still recommend that, if you have nested loops, give them meaningful names so it helps with reading the code later.

Already tried but it looks ugly that way, lengths of names does not match and it makes me uncomfortable. I think I need medical help

YOU HAVE AUTISM

Great example. What the fuck does opPrint mean ? It means nothing and looks ugly

If others need to work on your project, and see your variable 'names', they'll flip shit.

Underrated post

name them a, b, c, d ... and then just do the ol replace all trick

if you cant read a two line function with simple executions and don't know what it means you should kill yourself
#!/usr/env python
def printMessage(message):
print message
printMessage("OP is a flaming Faggot. He probably listens to that new Bill Nye song whilst fingering his asshole")

Ugly?

That's clean as fuck. Less is better ;)

>What should I do guys ?
Read code you made 6 months ago.

> Using python2 instead of superior Python 3

what is it ?
heheh I can understand. but it literally itches my eyes

that's not how you name functions in python

I'm a scientist we use python 2.7 (mostly)

How would you write it in python 3? Honestly curious

I can understand, but nobody else can do

What's the pythonic way?

I use camel case.

What language is this?

You need sensible names. A month later when you return to the code you'll waste less time trying to understand what the code does again or what it returns if you have it explained using names. Same for function/method names. If names are properly used you may even omit comments for specific parts.

If you think it "looks" wrong, then it's more likely your code is formatted wrong, has too many indentations, doesn't try to group actions and separate them into blocks with a newline.

You start by asking the function its preferred gender.

tcl. it is not much popular

what kind of scientist ? where ?

something like
:%s/\/name/gc

if name lenght bothers you then use a,b,c,d or come up with a standard length

If you are serious and the kind of stuff you see on r/mildlyinfuriating makes you unable to function as opposed to mildly niggled, then yeah you need medical help.

just change print x with print(x), 99% of the needed conversion in most Python2to3 projects is that.

Why the fuck did you do it ?

Genetics of autism and schizophrenia. SoCal.

4th year PhD student. I'm computational which is different from my other biology peeps.

thanks senpai

I am still on python2. Waiting for python3 to die off.

>i, j, k
All wrong: i denotes integers, j denotes temporary/secondary numbers, and k denotes indices.

>k denotes indices
kek
not using i for indices

thePurposeOfThisVariableIsToIterateTheOutermostLoopOfMyFunctionBody

self
documenting

OP sure is part of the reason.

They should have left it named Python3000, would have died off without any problem

half Hungarian

def name_of_function():

2.7 to 3.6 has a serious performance increase

i now realize u did not ask to compare the two.

what is wrong with me?

what do you mean by "half hungarian" ?

its simple. if no one else will ever need to edit the code, and you're smart enough to know what the variables are for, use a,b,c,d.

else use descriptive names.

That or CDO.
You really should get checked out.

>CDO
You mean OCD?

If not having the letters in OCD in alphabetical order drives someone nuts, then they have CDO.

>message
>not m
>opPrint()
>not opP
Typical Pyfag

>What should I do guys ?
Nothing.
Unless you have a code review to pass, it doesn't matter. You don't care and the compiler doesn't either.
You just have to figure out what you do when you run out of letters.

You name them with really long names, but at the same time introduce variables with the exact same name except for an easily mistakable character.

Ex.
Printlambda
Printiambda

I'm actually a Perler
#!/usr/bin/perl
use strict; use warnings;
sub message {
my $message = shift @_;
print $message."\n";
}
message("OP is still a faggot");

Give it cute anime grill's name

For small functions like that it doesn't really matter.