Re: an error in python lib?

2012-10-11 Thread Wenhua Zhao
> On Wed, Oct 10, 2012 at 6:18 AM, Ulrich Eckhardt >> The comment clearly states "owned by current thread", not "owned by any >> thread". The latter would also be useless, as that can change concurrently >> at any time when owned by a different thread, so making decisions on this >> state is futile

an error in python lib?

2012-10-09 Thread Wenhua Zhao
Hi list, I just noticed that in /usr/lib/python2.7/threading.py class _Condition(_Verbose): ... def _is_owned(self): # Return True if lock is owned by current_thread. # This method is called only if __lock doesn't have _is_owned(). if self.__lock.acquire(0):

How to filter a dictionary ?

2012-04-11 Thread Wenhua Zhao
Hi, Nikhil Verma writes: > In [9]: (k for k,v in for_patient_type.iteritems() if v == 'Real') You can use dict comprehension, just change () to {}. >>> for_patient_type = {37: u'Test', 79: u'Real', 80: u'Real', 81: u'Real', 83: >>> u'Real', 84: u'Real', 91: u'Real', 93: u'Real'} >>> {k:v for k

Does python support the expression "a = b | 1"???

2005-10-05 Thread Wenhua Zhao
a = b | 1 a = b if b != nil else a =1 Is there such expression in python? Thanks a lot! -- http://mail.python.org/mailman/listinfo/python-list

Re: How to create temp file in memory???

2005-10-05 Thread Wenhua Zhao
Jones wrote: > Wenhua Zhao wrote: > >> A.T.T >> >> Thanks a lot. >> >> > If you could elaborate a bit more, it might be helpful. I'm guessing > you want something like StringIO or cStringIO. > > > - jmj -- http://mail.python.org/mailman/listinfo/python-list

How to create temp file in memory???

2005-10-05 Thread Wenhua Zhao
A.T.T Thanks a lot. -- http://mail.python.org/mailman/listinfo/python-list