Pyrhon2.5 to 2.4 conversion

2010-02-27 Thread tarek...@gmail.com
Hi,

I am currently using oauth2.py library, and it works fine on one of my
PC's (python2.5), but later on when I tried to use it with python2.4
the following line (line 332 in 
http://github.com/simplegeo/python-oauth2/blob/master/oauth2/__init__.py)
showed a syntax error

items = [(k, v if type(v) != ListType else sorted(v)) for k,v in
sorted(self.items()) if k != 'oauth_signature']

So it there a way to convert this line to a python2.4 compliant
syntax.

Thanks a lot,
Tarek
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Pyrhon2.5 to 2.4 conversion

2010-03-09 Thread tarek...@gmail.com
Thanks a lot everybody for your help, it worked now :)

On Feb 28, 4:12 am, MRAB  wrote:
> tarek...@gmail.com wrote:
> > Hi,
>
> > I am currently using oauth2.py library, and it works fine on one of my
> > PC's (python2.5), but later on when I tried to use it with python2.4
> > the following line (line 332 
> > inhttp://github.com/simplegeo/python-oauth2/blob/master/oauth2/__init__.py)
> > showed a syntax error
>
> > items = [(k, v if type(v) != ListType else sorted(v)) for k,v in
> > sorted(self.items()) if k != 'oauth_signature']
>
> > So it there a way to convert this line to a python2.4 compliant
> > syntax.
>
> I think the clearest is:
>
> items = []
> for k, v in sorted(self.items()):
>      if k != 'oauth_signature':
>          if type(v) == ListType:
>              v = sorted(v)
>          items.append((k, v))

-- 
http://mail.python.org/mailman/listinfo/python-list