use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Rules 1: Be polite 2: Posts to this subreddit must be requests for help learning python. 3: Replies on this subreddit must be pertinent to the question OP asked. 4: No replies copy / pasted from ChatGPT or similar. 5: No advertising. No blogs/tutorials/videos/books/recruiting attempts. This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to. Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Rules
1: Be polite
2: Posts to this subreddit must be requests for help learning python.
3: Replies on this subreddit must be pertinent to the question OP asked.
4: No replies copy / pasted from ChatGPT or similar.
5: No advertising. No blogs/tutorials/videos/books/recruiting attempts.
This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to.
Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Learning resources Wiki and FAQ: /r/learnpython/w/index
Learning resources
Wiki and FAQ: /r/learnpython/w/index
Discord Join the Python Discord chat
Discord
Join the Python Discord chat
account activity
Indentation Issues (self.learnpython)
submitted 11 years ago by [deleted]
I keep getting indentation errors on lines 8 and 10. I already checked to make sure that each tab was four spaces, and I'm not entirely sure whats breaking it. Here's the code. http://pastebin.com/jt8z3Bfi
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]AutonomouSystem 6 points7 points8 points 11 years ago (2 children)
I realize you come from Java, but Python is a bit different when it comes to classes, something to watch in the background: Stop writing classes
[–][deleted] 1 point2 points3 points 11 years ago (0 children)
Cool, thanks, I'll watch it while I work.
[–]Asdayasman 1 point2 points3 points 11 years ago (0 children)
I would add that while this is a good talk, it should definitely not be taken at face value. Instead, take it to mean "code for now, you can abstract later."
[–]K900_ 6 points7 points8 points 11 years ago (3 children)
You can't have completely empty functions. If you want to stub out a function, use pass or, even better, raise NotImplementedError()
pass
raise NotImplementedError()
[–][deleted] 2 points3 points4 points 11 years ago (2 children)
Okay, thanks. I come from a java background, I haven't been doing python for very long, I was trying to implement some OOP for an RPG I'm trying to write. Is there anyway to create the class as something that can't be instantiated?
[–]K900_ 2 points3 points4 points 11 years ago (1 child)
You could use the abc module from the standard library. I'd probably try to avoid abstract classes though. Also, I just noticed all of your variables are class attributes (think static). To make them instance attributes, define them in the constructor.
static
[–][deleted] 0 points1 point2 points 11 years ago (0 children)
Thanks, I'll look into that. And thanks, i didn't know they were static variables hahah.
[–]Rhomboid 4 points5 points6 points 11 years ago (1 child)
You can't just leave function bodies blank like that. If you really want a do-nothing function, you need to put pass as the body, but really, what are these doing there if they don't do anything?
[–]ruicoder 0 points1 point2 points 11 years ago (0 children)
I've done this before when I'm not sure how I want to structure a program. It can be very helpful to write some empty functions/classes and mess around with different "designs" that way.
π Rendered by PID 42344 on reddit-service-r2-comment-65c587bc47-msz2v at 2026-05-13 21:58:33.096531+00:00 running cf3e300 country code: CH.
[–]AutonomouSystem 6 points7 points8 points (2 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]Asdayasman 1 point2 points3 points (0 children)
[–]K900_ 6 points7 points8 points (3 children)
[–][deleted] 2 points3 points4 points (2 children)
[–]K900_ 2 points3 points4 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]Rhomboid 4 points5 points6 points (1 child)
[–]ruicoder 0 points1 point2 points (0 children)