a_list.count(a_callable) ?

2007-06-14 Thread Ping
aster. This is my first post and please bear with me if I'm not posting it in the right way. Regards, Ping -- http://mail.python.org/mailman/listinfo/python-list

Re: a_list.count(a_callable) ?

2007-06-15 Thread Ping
? There are several possible designs but I'm not sure which is better. Ping -- http://mail.python.org/mailman/listinfo/python-list

Re: a_list.count(a_callable) ?

2007-06-15 Thread Ping
On 6 15 , 11 17 , Dustan <[EMAIL PROTECTED]> wrote: > On Jun 15, 9:15 am, Ping <[EMAIL PROTECTED]> wrote: > > > > sum(1 for i in a_list if a_callable(i)) > > > > -- > > > Carsten Haesehttp://informixdb.sourceforge.net > > > This works nic

Re: a_list.count(a_callable) ?

2007-06-15 Thread Ping
On 6 16 , 12 33 , Carsten Haese <[EMAIL PROTECTED]> wrote: > On Fri, 2007-06-15 at 14:15 +0000, Ping wrote: > > using sum(1 ...) to mean count() isn't very intuitive > > I find it very intuitive, but then again, my years of studying Math may > have skewed my intuitio

Re: a_list.count(a_callable) ?

2007-06-16 Thread Ping
_() method, but > it fails when you need to search, sort or count on a different key. > > -- > mvh Björn Wow! This jumps out of my screen! I like it very much. How to get the extension into the language? cheers, Ping p.s. By the way, I guess you meant print L[L.index(1234, key = attrgetter("id"))].name in the index example. -- http://mail.python.org/mailman/listinfo/python-list

Re: a_list.count(a_callable) ?

2007-06-17 Thread Ping
works fine for me. It would be great to see it supported by the built-in list. :) cheers, Ping $ cat slist.py #!/usr/bin/env python from operator import * class slist (list): def count(self, value, cmp=None, key=None): if not cmp and not key: return list.count(s

Re: a_list.count(a_callable) ?

2007-06-17 Thread Ping
> print "b has", b.count(25, cmp=le, key=attrgetter("age")), \ > "elements with age <= 25." > [deleted] > b has 2 elements with age <= 30. Oops, I mixed up when copying and pasting at different times... :p The output was of course

A patch to support L.count(value, cmp=None, key=None)

2007-06-18 Thread Ping
s the first time that I modified CPython source, and I may very well make mistakes in (lack of) reference counting or other things. Comments and corrections are much appreciated! Regards, Ping --- Objects/listobject.c.orig Sun Oct 29 05:39:10 2006 +++ Objects/listobject.cTue Jun 19 01:

Asynchronous HTTP client

2010-03-06 Thread Ping
2001 and is seriously out of sync with httplib. I'd appreciate it if anyone can shed some lights on this. Thanks, Ping -- http://mail.python.org/mailman/listinfo/python-list

Python compiling with third party tools

2015-12-25 Thread Ping Liu
install any of those tools or even python itself. Does anyone know how to do this? Any advice is appreciated. Ping -- https://mail.python.org/mailman/listinfo/python-list

memory control in Python

2015-08-14 Thread Ping Liu
Aineq), how can we reduce the memory usage in python programming? 2) how can I reduce the memory usage of different solvers in Python? Why would the memory decrease for the CPLEX solver within the 24-hours-in-one-day case compared with the case 1? Thanks in advance, Ping solver memory comparison

Re: memory control in Python

2015-08-17 Thread Ping Liu
On Saturday, August 15, 2015 at 11:56:22 AM UTC-7, Laura Creighton wrote: > If the problem is that Python is using too much memory, then PyPy may > be able to help you. PyPy is an alternative implementation of Python, > and by defaiult uses a minimark garbage collector. > https://pypy.readthedocs.

Re: memory control in Python

2015-08-17 Thread Ping Liu
Hi, Dieter, If I move from Python to Jython or IronPython, do I need to retool whatever I have done? If so, that may take quite a long time. This may make the reimplementation impossible. -- https://mail.python.org/mailman/listinfo/python-list

Re: memory control in Python

2015-08-18 Thread Ping Liu
Hi, Oscar, Your feedback is very valuable to me since you dig into the problem itself. Basically, we are trying to develop an open source software with multiple interface to several free solvers so that we can switch among them in case one of them is not working or so efficient. The optimizati

struct unpack issue

2008-06-13 Thread Ping Zhao
sr/lib/python2.5/struct.py", line 87, in unpack return o.unpack(s) struct.error: unpack requires a string argument of length 8 It was weired that the required argument length increased to 8. Any idea on this? I am using a 32bit pentium-m and the picture file was stored in little-edian format. Sincerely

cheetah.

2006-07-01 Thread chun ping wang
I am having trouble using cheetah and getting it to work the way i want (mvc) I have the following file. index.py : # imports BibleController and setting. BibleController.py that includes the Bible.py model to database (those works). At the end of it i have. print Template ( file = "BibleView

converting mysql db into sqlite3.

2006-12-15 Thread chun ping wang
hi, i have a simple problem of opening an existing mysql database with sqlite3. Is it possible? (I have an instinct that it is), however i don';t know the most easiest and straight forward approach to do so. Thanks for the help.

modifying iterator value.

2006-04-26 Thread chun ping wang
Hi, I have something simple i want to do. i want to modify an iterator value. for x in someList x = 1 is it possible to do that..if not how do i modify a list using iteration. _ Express yourself instantly with MSN Messenger! Do

python rounding problem.

2006-05-07 Thread chun ping wang
Hey i have a stupid question. How do i get python to print the result in only three decimal place... Example>>> round (2.9954254, 3) 2.9951 but i want to get rid of all trailing 0's..how would i do that? _ Expre

make two tables having same orders in both column and row names

2009-11-19 Thread Ping-Hsun Hsieh
Hi, I would like to compare values in two table with same column and row names, but with different orders in column and row names. For example, table_A in a file looks like the follows: AA100 AA109 AA101 AA103 AA102 BB1 2 9 2.3 1 28 BB3 12 9 2.3