Re: how to cut and paste in the windows of python(command line)

2008-07-24 Thread fang
Dear: Thank you very much! I can do it! It's very nice! -- http://mail.python.org/mailman/listinfo/python-list

how to cut and paste in the windows of python(command line)

2008-07-24 Thread fang
Dear all: The mouse cannot be responded in the windows of python(command line) and cut and paste cannot be done. ctrl c and ctrl v do not work. But they do work in IDLE. please teach me about the python(command line). -- http://mail.python.org/mailman/listinfo/python-list

Re: how to debug python's extend module written in c/c++ on windows

2008-07-17 Thread fang
Dear Diez: I see. I appreciate your help really. best regards fang -- http://mail.python.org/mailman/listinfo/python-list

Re: how to debug python's extend module written in c/c++ on windows

2008-07-17 Thread fang
Dear Diez: It is attaching a C-debugger to python. I can attach python- debugger(for example:wingIDE) to c-debugger(for example:VS2008), but I cannot attach VS2008 to wingIDE. I need both python statement and c statement can be single-step debugged. best regards fang -- http://mail.python.org

Re: How can I create customized classes that have similar properties as 'str'?

2007-11-27 Thread Licheng Fang
On Nov 27, 10:45 am, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Sun, 25 Nov 2007 02:42:36 -0800, Licheng Fang wrote: > > I mentioned trigram counting as an illustrative case. In fact, you'll > > often need to define patterns more complex than that, and te

Re: How can I create customized classes that have similar properties as 'str'?

2007-11-25 Thread Licheng Fang
On Nov 25, 5:59 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Sat, 24 Nov 2007 03:44:59 -0800, Licheng Fang wrote: > > On Nov 24, 7:05 pm, Bjoern Schliessmann > [EMAIL PROTECTED]> wrote: > >> Licheng Fang wrote: > >> > I find

Re: How can I create customized classes that have similar properties as 'str'?

2007-11-24 Thread Licheng Fang
On Nov 24, 9:42 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Sat, 24 Nov 2007 13:40:40 +0100, Bjoern Schliessmann wrote: > > Licheng Fang wrote: > >> On Nov 24, 7:05 pm, Bjoern Schliessmann > >> Wow, I didn't know this. But exact

Re: How can I create customized classes that have similar properties as 'str'?

2007-11-24 Thread Licheng Fang
On Nov 24, 7:05 pm, Bjoern Schliessmann wrote: > Licheng Fang wrote: > > I find myself frequently in need of classes like this for two > > reasons. First, it's efficient in memory. > > Are you using millions of objects, or MB size objects? Otherwise, > this is no ar

Re: How can I create customized classes that have similar properties as 'str'?

2007-11-24 Thread Licheng Fang
I find myself frequently in need of classes like this for two reasons. First, it's efficient in memory. Second, when two instances are compared for equality only their pointers are compared. (I think that's how Python compares 'str's. On Nov 24, 6:31 pm, Licheng Fang <[

How can I create customized classes that have similar properties as 'str'?

2007-11-24 Thread Licheng Fang
I mean, all the class instances that equal to each other should be reduced into only one instance, which means for instances of this class there's no difference between a is b and a==b. Thank you. -- http://mail.python.org/mailman/listinfo/python-list

Accessing Function Variables from Sub-functions

2007-10-11 Thread Licheng Fang
On Apr 14 2003, 10:30 pm, Alex Martelli <[EMAIL PROTECTED]> wrote: > Sebastian Wilhelmi wrote: > > Hi, > > > I would like to do the following: > > > ---8<---8<---8<---8<--- > > def test (): > > count = 0 > > def inc_count (): > > count += 1 > > inc_count () >

Re: Problem of Readability of Python

2007-10-10 Thread Licheng Fang
On Oct 8, 4:24 am, [EMAIL PROTECTED] (Alex Martelli) wrote: > Licheng Fang <[EMAIL PROTECTED]> wrote: > >... > > > Python Tutorial says an empty class can be used to do this. But if > > namespaces are implemented as dicts, wouldn't it incur much overhead

Problem of Readability of Python

2007-10-07 Thread Licheng Fang
Python is supposed to be readable, but after programming in Python for a while I find my Python programs can be more obfuscated than their C/C ++ counterparts sometimes. Part of the reason is that with heterogeneous lists/tuples at hand, I tend to stuff many things into the list and *assume* a stru

Re: extremely slow array indexing?

2006-11-30 Thread Grace Fang
Hi will,Thanks for your reply. The simplified code is as follows, and you can run it if you like. It takes 7 seconds to process 1000 rows, which is tolerable, but I wonder why it takes so long, because I also did one for loop through all of the same rows without accessing array, which only takes 1

extremely slow array indexing?

2006-11-30 Thread Grace Fang
Hi, I am writing code to sort the columns according to the sum of each column. The dataset is huge (50k rows x 300k cols), so i need to read line by line and do the summation to avoid the out-of-memory problem. But I don't know why it runs very slow, and part of the code is as follows. I suspect i

Re: How to get the "longest possible" match with Python's RE module?

2006-09-14 Thread Licheng Fang
Thank you guys. I've written a CYK parser and realized this is the right direction. It gives every possible interpretation of the string and I can retrieve whatever I want. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to get the "longest possible" match with Python's RE module?

2006-09-12 Thread Licheng Fang
[EMAIL PROTECTED] wrote: > kondal wrote: > > > This is the way the regexp works python doesn't has anything to do with > > it. It starts parsing the data with the pattern given. It returns the > > matched string acording the pattern and doesn't go back to find the > > other combinations. > > I've

Re: How to get the "longest possible" match with Python's RE module?

2006-09-12 Thread Licheng Fang
Bryan Olson wrote: > Licheng Fang wrote: > > Oh, please do have a look at the second link I've posted. There's a > > table comparing the regexp engines. The engines you've tested probably > > all use an NFA implementation. > > Unfortunately, the stuff a

Re: How to get the "longest possible" match with Python's RE module?

2006-09-11 Thread Licheng Fang
Thank you very much, Tim and Monkee. In fact, what I'm doing is handle a lot of regular expressions. I wanted to build VERY LONG regexps part by part and put them all into a file for easy modification and maintenance. The idea is like this: (*INT) = \d+ (*DECIMAL) = (*INT)\.(*INT) (*FACTION) = (*

Re: How to get the "longest possible" match with Python's RE module?

2006-09-11 Thread Licheng Fang
Oh, please do have a look at the second link I've posted. There's a table comparing the regexp engines. The engines you've tested probably all use an NFA implementation. MonkeeSage wrote: > Licheng Fang wrote: > > Hi, according to these regexp engine discussions, it'

Re: How to get the "longest possible" match with Python's RE module?

2006-09-11 Thread Licheng Fang
MonkeeSage wrote: > Licheng Fang wrote: > > Basically, the problem is this: > > > > >>> p = re.compile("do|dolittle") > > >>> p.match("dolittle").group() > > 'do' > > >From what I understand, this isn'

How to get the "longest possible" match with Python's RE module?

2006-09-11 Thread Licheng Fang
Basically, the problem is this: >>> p = re.compile("do|dolittle") >>> p.match("dolittle").group() 'do' Python's NFA regexp engine trys only the first option, and happily rests on that. There's another example: >>> p = re.compile("one(self)?(selfsufficient)?") >>> p.match("oneselfsufficient").gro

Re: Modules... paths... newbie confusion

2006-08-21 Thread Licheng Fang
MrBlueSky wrote: > I wonder if someone could clarify how Python "knows" where modules are > - or at least point to some documentation that might help me? Here's > what I've been trying: > > I've installed Python 2.4 Windows, and have also installed tkinter, > pmw, cx_Oracle, mssql and pytz (phew!

Re: Python and STL efficiency

2006-08-21 Thread Licheng Fang
Marc 'BlackJack' Rintsch wrote: > In <[EMAIL PROTECTED]>, Licheng Fang > wrote: > > > Hi, I'm learning STL and I wrote some simple code to compare the > > efficiency of python and STL. > > > > //C++ > > #include > > #include

Python and STL efficiency

2006-08-20 Thread Licheng Fang
Hi, I'm learning STL and I wrote some simple code to compare the efficiency of python and STL. //C++ #include #include #include #include #include using namespace std; int main(){ vector a; for (long int i=0; i<1 ; ++i){ a.push_back("What do you know?");

Re: Nested Lists Assignment Problem

2006-04-26 Thread Licheng Fang
Dennis Lee Bieber wrote: > On 26 Apr 2006 01:13:20 -0700, "Licheng Fang" <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > > > > > Could anybody please explain to me why three values were change? I'm > > bewildered. Thank

Nested Lists Assignment Problem

2006-04-26 Thread Licheng Fang
I wanna use nested lists as an array, but here's the problem: >>> a = [[0]*3]*3 >>> a [[0, 0, 0], [0, 0, 0], [0, 0, 0]] >>> a[0][0] = 1 >>> a [[1, 0, 0], [1, 0, 0], [1, 0, 0]] Could anybody please explain to me why three values were change? I'm bewildered. Thanks! -- http://mail.python.org/mail

How to configure proxy authentication when using urllib2?

2006-02-19 Thread Licheng Fang
I use a HTTP proxy to connect to Internet. When I run ulropen command I get HTTP Error 407: Proxy authorization required. Could anybody tell me how to resolve this? Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: How to get the type of an object?

2005-12-21 Thread Licheng Fang
That helps. Thank you guys. -- http://mail.python.org/mailman/listinfo/python-list

How to get the type of an object?

2005-12-21 Thread Licheng Fang
I wrote a function with a list as its parameter. And the function has to perform different operations based on the datatypes of the elements. How can I decide whether an object is, say, a list or a string? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python GTK import error

2004-11-29 Thread Qianqian Fang
sorry keep bugging you guys, but this is somehow a wield problem that I am eager to solve. I checked the permission and it looks fine to me: lrwxrwxrwx 1 root root 26 Nov 28 04:06 /usr/lib/libgtk-x11-2.0.so.0 -> libgtk-x11-2.0.so.0.400.13 -rwxr-xr-x 1 root root 2862900 Oct 15 14:23 /usr/lib/l