Re: if the else short form

2010-10-10 Thread saeed.gnu
True == 1 True False == 0 True int(True) 1 int(False) 0 bool(1) True bool(0) False ‌But: str(fill==True)+',' is simpler than: (False,, True,)[fill==True] -- http://mail.python.org/mailman/listinfo/python-list

Re: easy question on parsing python: is not None

2010-08-09 Thread saeed.gnu
x is y means id(y) == id(y) x is not y means id(x) != id(x) x is not None means id(x) != id(None) x is not None is a really silly statement!! because id(None) and id of any constant object is not predictable! I don't know whay people use is instead of ==. you should write

Re: easy question on parsing python: is not None

2010-08-09 Thread saeed.gnu
On Aug 9, 3:41 pm, saeed.gnu saeed@gmail.com wrote: x is y          means   id(y) == id(y) x is not y      means   id(x) != id(x) x is not None   means   id(x) != id(None) x is not None  is a really silly statement!! because id(None) and id of any constant object is not predictable! I

Re: Python why questions

2010-08-09 Thread saeed.gnu
1)  Why do Python lists start with element [0], instead of element [1]?  Common sense would seem to suggest that lists should start with [1].   Because Zero is the neutral element of addition operation. And indexes (and all adresses in computing) involve with addition much more than

Re: unicode issue

2009-09-30 Thread saeed.gnu
I recommend to use UTF-8 coding(specially in GNU/Linux) then write this in the second line: #-*- coding: latin-1 -*- -- http://mail.python.org/mailman/listinfo/python-list