[Python-ideas] parameter omit

Steven Bethard steven.bethard at gmail.com
Fri May 11 08:50:08 CEST 2007


On 5/11/07, Aaron Brady <castironpi at comcast.net> wrote:
> Take a shot at this one.
>
> class WebRetrieveElement:
>         def netretrieveOld( self ):
>                 if hasattr( self,'hook' ) and self.filename:
>                         urlretrieve( self.url, self.filename, self.hook )
>                 elif hashook:
>                         urlretrieve( self.url, reporthook= self.hook )
>                 else:
>                         urlretrieve( self.url, self.filename )

def netretrieve(self):
    kwargs = {}
    if self.filename:
        kwargs['filename'] = self.filename
    if hasattr(self, 'hook'):
        kwargs['reporthook'] = self.hook
    urlretrieve(self.url, **kwargs)


STeVe
-- 
I'm not *in*-sane. Indeed, I am so far *out* of sane that you appear a
tiny blip on the distant coast of sanity.
        --- Bucky Katt, Get Fuzzy



More information about the Python-ideas mailing list