"and" and "or" on every item in a list

2007-10-29 Thread GHZ
Is this the best way to test every item in a list? def alltrue(f,l): return reduce(bool.__and__,map(f,l)) def onetrue(f,l): return reduce(bool.__or__,map(f,l)) >>> alltrue(lambda x:x>1,[1,2,3]) False >>> >>> alltrue(lambda x:x>=1,[1,2,3]) True >>> Thanks -- http://mail.python.org/mai

Re: "and" and "or" on every item in a list

2007-10-29 Thread GHZ
Thanks for the answers, I suspected something like any(), all() existed. Also got me thinking about generator expressions, my code is full of list comprehensions for lists I don't keep. -- http://mail.python.org/mailman/listinfo/python-list

Re: Noob question

2008-01-06 Thread GHZ
Had the same issue. What you want is: reload() -- http://mail.python.org/mailman/listinfo/python-list

Re: Recommended SOAP library?

2009-01-22 Thread GHZ
if you require a SOAP client, then I would recommend SUDS https://fedorahosted.org/suds/ Other options are not in active development, so is difficult to get support. -- http://mail.python.org/mailman/listinfo/python-list

Re: Installing paramiko and pycrypto

2008-07-01 Thread GHZ
I installed from here: http://bazaar-vcs.org/WindowsInstall first pycrypto-2.0.1.win32-py2.5.zip then paramiko-1.7.1-ctypes.win32.exe -- http://mail.python.org/mailman/listinfo/python-list

Re: Why is there no GUI-tools like this for Windows?

2008-07-13 Thread GHZ
There is http://www.codeplex.com/IronPythonStudio -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I compare files?

2008-07-22 Thread GHZ
On Jul 23, 1:27 am, Clay Hobbs <[EMAIL PROTECTED]> wrote: > I am making a program that (with urllib) that downloads two jpeg files > and, if they are different, displays the new one.  I need to find a way > to compare two files in Python.  How is this done? > > -- Ratfink import hashlib file = op

filter in for loop

2008-08-28 Thread GHZ
I would like to say something like: for x in l if : e.g. for filename in os.listdir(DIR) if filename[-4:] == '.xml': instead of having to say: for filename in os.listdir(DIR): if filename[-4:] == '.xml': or for filename in (f for f in os.listdir(DIR) if f[-4] == '.xml