li.reverse() does not return a list it just changes the list li. val = 00110 is evaluated in base 8 try without leading 0s
On 10/17/07, Ixiaus <[EMAIL PROTECTED]> wrote: > > I have recently (today) just started learning/playing with Python. So > far I am excited and impressed (coming from PHP background). > > I have a few questions regarding Python behavior... > > val = 'string' > li = list(val) > print li.reverse() > > returns nothing, but, > > val = 'string' > li = list(val) > li.reverse() > print li > > returns what I want. Why does Python do that? > > Also I have been playing around with Binary math and noticed that > Python treats: > > val = 00110 > > as the integer 72 instead of returning 00110, why does Python do that? > (and how can I get around it?) > > Grateful for any replies! > > -- > http://mail.python.org/mailman/listinfo/python-list > -- Furkan Kuru
-- http://mail.python.org/mailman/listinfo/python-list