function overloading

Simon Burton simonb at webone.com.au
Tue Jul 1 21:42:06 CEST 2003


I just wrote the following rediculous code.
What do people do when they need to overload like this?

Simon.



######################################################
# PIL stuff

class Im:
  def __init__(self,x,xx=None):
    if xx is not None:
      w,h = x,xx
      im = Image.new("I",(w,h))
    elif type(x)==str:
      filename = x
      im = Image.open(filename)
    else:
      im = x
    self.im = im





More information about the Python-list mailing list