Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

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

0 views
Skip to first unread message

Peter S Galbraith

unread,
Jan 8, 2002, 9:04:15 PM1/8/02
to
Kim Oldfield <deb...@oldfield.wattle.id.au> wrote:

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

dman <dsh...@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 <and...@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


--
To UNSUBSCRIBE, email to debian-pyt...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org

0 new messages