default variable value and cmd module

konghyeogjun toto2001 at hananet.net
Tue Sep 10 09:22:58 EDT 2002


This sample using 'cmd' module do not prints default variable value, 5.

import cmd
class x(cmd.Cmd):
    def do_y(self, value = 5):
        print value
z = x()
z.cmdloop()

but, the following sample prints '5'. why don't the sample above prints?

class x:
    def do_y(self, value = 5):
        print value
z = x()
z.do_y()















More information about the Python-list mailing list