How can I extend Image class?

I want to extend "Image" class in PIL.

#module Image
def open(file): ...
class Image:
    def method1:...
    def method2:...

#module myOriginal
from Image import Image
class ExtendedImage(Image):
    def method3:...

#module test
import myOriginal
im = myOriginal.open("picture.jpg")

RESULT: Error.myOriginal has no attribute "open".

How can I extend Image class without rewriting open() method?

6
задан Yugo Kamo 2 March 2011 в 09:00
поделиться