[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Fwd: Re: need help updating imgsizer for python2.1



Kim Oldfield <debian@oldfield.wattle.id.au> wrote:

> Some further replies which don't appear to have been copied to you.
> 
> Regards,
> Kim

dman <dsh8290@rit.edu> wrote:
 
> I'd prefer to write this as
> 
> try :
>     import filecmp as cmp
> except ImportError :
>     import cmp
> 
> It is more pythonic to just try to do what it is you want, and handle
> the situation when it fails, than it is do try and figure out what is
> write and do only that which works.
> 
> | ] The package currently depends on python1.5.  What should it depend on
> | ] when fixed?
> | 
> | python
> 
> This must be versioned though.  
>     python >= (2.1) , python << (2.2)
> will get you the current default version.

Andrew Bennetts <andrew@puzzling.org> wrote:
 
> On Tue, Jan 08, 2002 at 06:51:44AM -0500, dman wrote:
> > I'd prefer to write this as
> > 
> > try :
> >     import filecmp as cmp
> > except ImportError :
> >     import cmp
> > 
> > It is more pythonic to just try to do what it is you want, and handle
> > the situation when it fails, than it is do try and figure out what is
> > write and do only that which works.
> 
> Except that in this case, versions of python before 2.0 will give a
> SyntaxError, because "import spam as eggs" is a new feature as of 2.0.
> 
> To be backwards compatible, use:
> 
>     try:
>         import filecmp
>         cmp = filecmp
>         del filecmp
>     except ImportError:
>         import cmp
> 
> -Andrew.


Thanks guys!  I'll try the above in the next few days, and I'll come
back if I have more questions.  Many thanks!

Peter



Reply to: