What Bad Habits Do You Still Do While Programming?

What bad habits do you still do while you’re programming (and any specific programming languages with it)?

I’ll go first, I don’t indent the code “correctly” for Python. Sometimes I use the recommended 4 spaces for indenting, other times I use 2 spaces for indenting. I also don’t include the “correct” amount of spaces for things like functions and import statements →
– What I do

def print(text):

— What I should do

def print(text):

Why the line gap? I’ve never done that, and black doesn’t format like that either.

1 Like

@Firepup650 I’ve seen people, and formatters, put a gap between the def and code for the function, but :person_shrugging:.

1 Like

Over time, my formatting has gotten closer and closer to how black formats, and I run it over my code every now and then.


I don’t really anymore, but using var instead of let

Ended up just seamlessly switching; every time I almost used var, I typed let and now it’s engrained.


Only add a line gap for nested functions, that looks horrible tbh

import functools

def decorator(function):

    def wrapper(*args, **kwargs):
        return function(*args, **kwargs)

    return wrapper

def function():
    print("Hello, world!")

Sorry, but I just had to Google engrained vs ingrained, and the search results are conflicting.

On a more on-tipic note though, I tend to write really long and convoluted if statements. Here’s an example I wrote:

for key in topicdb.keys():
    if (query_value in topicdb[key]['content'] or query_value in topicdb[key]['replies'] for reply in topicdb[key]['replies']) and (query_value not in ignoreWords for value in ignoreWords):
      topicsSearched.append([key, contentyes := query_value in topicdb[key]['content']])

So naturally, when I look back to edit something, I will get confused by my own logic.
Then, Qwerty would come along and edit it to half its length. (Thanks, btw).
And that’s my bad habit.


I don’t seem to have any bad habits with writing code or syntax. But I have a bad habit that I try to eradicate, and it is that I often write all the code in one big file, and then I don’t understand anything about it. But lately I’ve been trying to split the code into different files.


Horrible function and variable names (like a, aa, aC).


sometimes when I’m in a hurry (don’t know why) I use 1 space as indent in python
like this

def bruh(bozo):
 for L, R in enumerate(bozo):
  print(f'L/R ratio of bozo is {L/R} bruh')
if __name__ == "__main__":
  1, 2, 3, 5, 4, 6, 2, 2,2 ,5,7]

oh yes and indents are not regular, sometimes 1, sometimes 10, sometimes 2 or 3 don’t know why


The line doesn’t seem to do what you intended it to do:

1 Like

oops, corrected

I copied it from my test repl and it used logging instead of print so yes

1 Like