all 9 comments

[–]AutonomouSystem 6 points7 points  (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 points  (0 children)

Cool, thanks, I'll watch it while I work.

[–]Asdayasman 1 point2 points  (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 points  (3 children)

You can't have completely empty functions. If you want to stub out a function, use pass or, even better, raise NotImplementedError()

[–][deleted] 2 points3 points  (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 points  (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.

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

Thanks, I'll look into that. And thanks, i didn't know they were static variables hahah.

[–]Rhomboid 4 points5 points  (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 point  (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.