On May 28, 2013 1:10 PM, "Carlos Nepomuceno" <carlosnepomuc...@outlook.com>
wrote:
>
> Thank you! I made it run like the following. What do you think about
that? IS there a better way?
>
>
>
> #The following runs on Python 2.7
> sc3='''
> # Python 3
> def original(n):
>     m = 0
>     for b in n.to_bytes(6, 'big'):
>         m = 256*m + b
>     return m
> '''
> if sys.version_info[0] == 3:
>     exec(sc3)
> --

No need for exec.

if sys.version_info[0] >= 3:
    def original(n) :
       ...
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to