[Tutor] class newbie

Danny Yoo dyoo at hashcollision.org
Sun Jul 23 20:35:20 EDT 2017


On Sun, Jul 23, 2017 at 1:24 PM, Michael C
<mysecretrobotfactory at gmail.com> wrote:
> class mahschool:
>     def print():
>         print('Say something')


By the way, you've chosen a name for your method that's spelled the
same as the name of the built-in "print" function.  I'd recommend you
choose a different name than "print" in your method name, just to
avoid any potential confusion.  This isn't going to solve the
immediate problem that you encountered and solved: you figured out
that methods need to have a self argument.  But you probably still
want to rename to avoid the name collision.


Good luck!


More information about the Tutor mailing list