[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] A question about callback functions



> Have a look at this interactive session!
>
> C:\Documents and Settings\guillaume>\python23\python
> Python 2.3.5 (#62, Feb  8 2005, 16:23:02) [MSC v.1200 32 bit (Intel)] on
> win32
> Type "help", "copyright", "credits" or "license" for more information.
>  >>> class FirstClass:
> ...     def __init__(self,value):
> ...             self.val=value
> ...     def show(self):
> ...             print "FirstClass",self.val
> ...
>  >>> class SecondClass:
> ...     def __init__(self,value):
> ...             self.val=value
> ...     def show(self):
> ...             print "SecondClass",self.val
> ...
>  >>> classname = "SecondClass"
>  >>> myclass = eval(classname)
>  >>> instance = apply(myclass,(3,))
>  >>> instance.show()
> SecondClass 3
>  >>>
>


WOW! That is so awsome!

I am convinced, Python is the best language I have ever used :)

Thanks a bunch!