OOP inheritance - Intermediate Python Programming p.17

preview_player
Показать описание
Inheritance allows you to create super simple classes, and for your users to modify the classes, or for you to easily modify and tweak other people's classes.

Рекомендации по теме
Комментарии
Автор

Congratulations, I follow this channel for quite a long time and definitely, this is your best series.

tiobraulio
Автор

I'm really enjoying this series. Will you be covering @property's and such? Keep up the awesome work!

sirpeanutgaming
Автор

You should try making an intermediate pygame tutorial where you show how to implement OOP, multiprocessing, some other performance improving tricks, etc. would be so cool. Thanks for the great content man.

trunghung
Автор

It should be *random.randrange(-7, 8)* instead of random.randrange(-7, 7) or the blobs will run away to the top left corer :D

VascoCC
Автор

Hi Harrison, when are you going to talk about design patterns? as it's already inheritance now

colingnohz
Автор

What is the point of creating a BlueBlob class if you still have to provide a color?
Wouldn't this actually serve the purpose:

class BlueBlob(Blob):
def __init__(self, x_boundary, y_boundary):
super().__init__(BLUE, x_boundary, y_boundary)

and then calling only BlueBlob with WIDTH and HEIGHT?

jansen-lrdp
Автор

Thanks for al the awesome videos! I watch them very regularly. By the way,  can't the import statement of Pygame in the main code be omitted, since it is only used in the blob class where it is already imported?

brambeer
Автор

Thanks for ur videos, I'm new to Python, but you explain perfect. Hello from Russia=)

ipave
Автор

Hey sentdex
This is a bit offtopic but what topics to you plan for the future?
And thank you for all the good tutorials!

letsgomc
Автор

great vid yet again. I have a question about this code not related to inheritance though.. Why is it that when we increase the movement speed, the blobs eventually cluster in the upper right corner? very peculiar to me.

treelight
Автор

All of my blobs eventually go up to the top left corner. I can't figure out why this is happening.. I made the change at ~9:30 with the self.x += random.randrange(-7, 7) etc... I just don't get why.

PS- in early videos I experimented with changing the start stop on movement_range to larger values and would get the same thing either all blobs goto upper left or lower right corners. If anyone has any thoughts I'd appreciate it.

damiendivittorio
Автор

Hi +sentdex I have a question about super. If you have a class inheriting from a and b, how would you use the super method to pass c variable to a and d variable to b to their __init__'s.

nic
Автор

Can you answer why we use self in a method signature?

ipave
Автор

Personally i preferred Eldest but Inheritance is still pretty good.

Dman