A methodological approach - alternative way of calling method?


#1

https://www.codecademy.com/courses/learn-python/lessons/introduction-to-classes/exercises/a-methodical-approach

I see, that in the sample solution you use

hippo.description()

to call the method.

I used

description(hippo)

which worked fine. Is there any adavantag/disadvantage in using either of those?


#2

the general syntax for calling methods is:

instance.method_name()

this should raise a NameError, saying that description is undefined. Maybe your browser is sending cached data? I put the code here:

https://repl.it/NwTd

and it throws an error, so there is only one way to call a method


#3

Thanks a lot, I also checked again: The code was acccidentally indented, so inside the class definition, that was why it worked, I guess.


#4

So is everything clear now? No more questions


#5

Yes, thanks :slight_smile:


#6