Re: What make function with huge list so slow

2019-08-25 Thread Windson Yang
> Figure out how much memory fib_dp is holding on to right before it returns > the answer. fib(40) is a _big_ number! And so is fib(39), and > fib(38), and fib(37), etc. By the time you're done, you're holding > on to quite a huge pile of storage here. Depending on how much phys

Re: What make function with huge list so slow

2019-08-24 Thread Windson Yang
'I'm just running them in succession and seeing how long they'. The full code looks like this, this is only an example.py here. and I run 'time python3 example.py' for each function. def fib_dp(n): dp = [0] * (n+1) if n <= 1: return n dp[0], dp[1] = 0, 1

Re: What make function with huge list so slow

2019-08-24 Thread Windson Yang
Thank you, Chris. I tried your suggestions. I don't think that is the reason, fib_dp_look() and fib_dp_set() which also allocation a big list can return in 2s. Chris Angelico 于2019年8月25日周日 上午11:27写道: > On Sun, Aug 25, 2019 at 12:56 PM Windson Yang wrote: > > > > I h

What make function with huge list so slow

2019-08-24 Thread Windson Yang
I have two functions to calculate Fibonacci numbers. fib_dp use a list to store the calculated number. fib_dp2 just use two variables. def fib_dp(n): if n <= 1: return n dp = [0] * (n+1) dp[0], dp[1] = 0, 1 for i in range(2, n+1): dp[i] =

Re: How should we use global variables correctly?

2019-08-23 Thread Windson Yang
019 09:07, Frank Millman wrote: > >On 2019-08-23 8:43 AM, Windson Yang wrote: > >>In class.py > >> > >> class Example: > >> def __init__(self): > >> self.foo = 1 > >> def bar() > >> retu

Re: How should we use global variables correctly?

2019-08-22 Thread Windson Yang
the global.py is short and clean enough (didn't have a lot of other class), they are pretty much the same. Or I missed something? Chris Angelico 于2019年8月23日周五 上午9:34写道: > On Fri, Aug 23, 2019 at 11:24 AM Windson Yang wrote: > > > > Thank you all for the great explanation,

Re: How should we use global variables correctly?

2019-08-22 Thread Windson Yang
Thank you all for the great explanation, I still trying to find some good example to use 'global', In CPython, I found an example use 'global' in cpython/Lib/zipfile.py _crctable = None def _gen_crc(crc): for j in range(8): if crc & 1: crc = (crc >> 1) ^

How should we use global variables correctly?

2019-08-22 Thread Windson Yang
I can 'feel' that global variables are evil. I also read lots of articles proves that (http://wiki.c2.com/?GlobalVariablesAreBad). However, I found CPython Lib use quite a lot of `global` keyword. So how should we use `global` keyword correctly? IIUC, it's fine that we use `global` keyword inside t

Re: fopen() and open() in cpython

2019-08-14 Thread Windson Yang
Thank you so much for the answer, now it makes sense :D eryk sun 于2019年8月15日周四 上午12:27写道: > On 8/13/19, Windson Yang wrote: > > After my investigation, I found Since Python maintains its own buffer > when > > read/write files, the build-in python open() function wi

fopen() and open() in cpython

2019-08-13 Thread Windson Yang
After my investigation, I found Since Python maintains its own buffer when read/write files, the build-in python open() function will call the open() system call instead of calling standard io fopen() for caching. So when we read/write a file in Python, it would not call fopen(), fopen() only use

Re: Understand workflow about reading and writing files in Python

2019-06-24 Thread Windson Yang
DL Neil 于2019年6月24日周一 上午11:18写道: > Yes, better to reply to list - others may 'jump in'... > > > On 20/06/19 5:37 PM, Windson Yang wrote: > > Thank you so much for you review DL Neil, it really helps :D. However, > > there are some parts still confused me,

Re: Understand workflow about reading and writing files in Python

2019-06-24 Thread Windson Yang
When you said "C-runtime buffered I/O", are you talking about Standard I/O in C (FILE * object)? AFAIN, In CPython, we didn't use Standard I/O, right? Dennis Lee Bieber 于2019年6月25日周二 上午12:48写道: > On Mon, 24 Jun 2019 15:18:26 +1200, DL Neil > declaimed the following: > > > > > >However, the OpSy

Fwd: Understand workflow about reading and writing files in Python

2019-06-23 Thread Windson Yang
1) is likely not that of (3) - otherwise why use a > "buffer"? The size of (2) must be larger than (1) and larger than (2) - > for reasons already illustrated. > Is this a typo? (2) larger than (1) larger than (2)? > > I recall learning how to use buffers with a series of hand

Understand workflow about reading and writing files in Python

2019-06-18 Thread Windson Yang
I'm trying to understand the workflow of how Python read/writes data with buffer. I will be appreciated if someone can review it. ### Read n data 1. If the data already in the buffer, return data 2. If the data not in the buffer: 1. copy all the current data from the buffer 2. create a new

Understand workflow about reading and writing files in Python

2019-06-17 Thread Windson Yang
I'm trying to understand the workflow of how python read/writes files with buffer. I drew a diagram for it. I will be appreciated if someone can review the diagram :D [image: 屏幕快照 2019-06-15 下午12.50.57.png] -- https://mail.python.org/mailman/listinfo/python-list

Questions about the IO modules and C-api

2019-06-02 Thread Windson Yang
I have some questions about the IO modules. 1. My script: f = open('myfile, 'a+b') f.close() I added a printf statement at the beginning of _io_open_impl , the output is: _io_open _io_open _io_open

write function call _io_BufferedWriter_write_impl twice?

2019-05-29 Thread Windson Yang
My script looks like this: f = open('myfile', 'a+b') f.write(b'abcde') And I also add a `printf` statement in the _io_BufferedWriter_write_impl function. static PyObject *

Duplicate function in thread_pthread.h

2019-05-27 Thread Windson Yang
When I try to understand the code about the thread. I found the thread_pthread.h file has some duplicate functions. Like `PyThread_free_lock`, `PyThread_release_lock`, `PyThread_acquire_lock_timed`. IIUC, C doesn't support function overload. So why we have functions with the same name and args? --

CPython compiled failed in macOS

2019-05-21 Thread Windson Yang
version: macOS 10.14.4, Apple LLVM version 10.0.1 (clang-1001.0.46.4). I cloned the CPython source code from GitHub then compiled it which used to work quite well. However, I messed up my terminal a few days ago for installing gdb. Now when I try to compile the latest CPython source code with ./co

How to configure trusted CA certificates for SSL client?

2017-02-07 Thread Yang, Gang CTR (US)
et the trusted CA certificates from, from Python or the underlying OS? What configuration do I need in order for the SSL client to conduct the SSL handshake successfully? Appreciate any help! Gang Gang Yang Shonborn-Becker Systems Inc. (SBSI) Contractor Engineering Supporting SEC Office:

RE: [Non-DoD Source] Re: Python 3.5.0 python --version command reports 2.5.4

2016-09-07 Thread Yang, Gang CTR (US)
Thanks to all that replied. Indeed I had CollabNet SVN server installed a while back and it came with an older version of Python. Gang Yang Shonborn-Becker Systems Inc. (SBSI) Contractor Engineering Supporting SEC Office: 732-982-8561, x427 Cell: 732-788-7501 Email: gang.yang@mail.mil

Python 3.5.0 python --version command reports 2.5.4

2016-09-06 Thread Yang, Gang CTR (US)
Hi, I just installed Python 3.5.0 (since 3.5.2 would not installed on Windows 2008 R2) and tried the python --version command. Surprisingly, the command reported 2.5.4. What's going on? Gang Yang Shonborn-Becker Systems Inc. (SBSI) Contractor Engineering Supporting SEC Office: 732-982

Python 3.5.0 python --version command reports 2.5.4

2016-09-06 Thread Yang, Gang CTR (US)
Hi, I just installed Python 3.5.0 (since 3.5.2 would not installed on Windows 2008 R2) and tried the python --version command. Surprisingly, the command reported 2.5.4. What's going on? Gang Yang Shonborn-Becker Systems Inc. (SBSI) Contractor Engineering Supporting SEC Office: 73

Conversion: execfile --> exec

2016-06-13 Thread Long Yang
The python 2.x command is as following: --- info = {} execfile(join('chaco', '__init__.py'), info) -- But execfile has been removed in python 3.x. So my problem is how to convert the above to a 3.x based command? thanks very much -- https://mai

sublime textx 3 and python 35

2015-12-16 Thread Yaocheng Frank Yang
Dear Python Team, I'm trying to install python35 and use sublime text 3 to write code on it. After I change the path name to the python app location. I still have some problem. I wrote a simple print function in sublime text(I already saved the file with .py extension) and the console show "fini

Re: Newbie question related to Boolean in Python

2013-09-05 Thread Thomas Yang
bear_moved = False while True: next = raw_input("> ") if next == "take honey": dead("The bear looks at you then slaps your face off.") elif next == "taunt bear" and not bear_moved: print "The bear has moved from the door. You can go through

Please recommend a open source for Python ACLs function

2012-03-19 Thread Yang Chun-Kai
Hello Dear All: I would like to write some simple python test code with ACL(Access Control List) functions. Now simply I aim to use MAC address as ACL parameters, is there any good ACL open source recommended for using? Simple one is better. Any tips or suggestions welcomed and appreciated.

RE: python2.7 kill thread and find thread id

2012-01-03 Thread Yang Chun-Kai
Sorry for the misarrangement of my code in list, it happens everytime. I apologized. From: waitmefore...@hotmail.com To: python-list@python.org Subject: python2.7 kill thread and find thread id Date: Wed, 4 Jan 2012 14:10:46 +0800 Hello,guys!! I am using python2.7 to write a simple thread

python2.7 kill thread and find thread id

2012-01-03 Thread Yang Chun-Kai
Hello,guys!! I am using python2.7 to write a simple thread program which print the current running thread id and kill it with this id. But I have some questions with this. My code: -from threading import Threadclass t(Thread): def __init__(

RE: Localhost client-server simple ssl socket test program problems

2011-12-16 Thread Yang Chun-Kai
> To: python-list@python.org > From: li...@cheimes.de > Subject: Re: Localhost client-server simple ssl socket test program problems > Date: Thu, 15 Dec 2011 20:45:43 +0100 > > Am 15.12.2011 20:09, schrieb Yang Chun-Kai: > > Server side error: > > &g

RE: Localhost client-server simple ssl socket test program problems

2011-12-15 Thread Yang Chun-Kai
hanks. Kay > To: python-list@python.org > From: li...@cheimes.de > Subject: Re: Localhost client-server simple ssl socket test program problems > Date: Thu, 15 Dec 2011 21:19:14 +0100 > > Am 15.12.2011 21:09, schrieb Yang Chun-Kai: > > Thanks for tips. > > >

RE: Localhost client-server simple ssl socket test program problems

2011-12-15 Thread Yang Chun-Kai
calhost client-server simple ssl socket test program problems > Date: Thu, 15 Dec 2011 20:45:43 +0100 > > Am 15.12.2011 20:09, schrieb Yang Chun-Kai: > > Server side error: > > > > File "views.py", line 17, in > > connstream = ssl.wrap_socket(newsocket, ser

Localhost client-server simple ssl socket test program problems

2011-12-15 Thread Yang Chun-Kai
Hello,everyone!! I am writing a simple ssl client-server test program on my personal laptop. And I encounter some problems with my simple programs. Please give me some helps.---

Re: Keyboard Layout: Dvorak vs Colemak: is it Worthwhile to Improve the Dvorak Layout?

2011-06-13 Thread Yang Ha Nguyen
On Jun 13, 11:30 am, Tim Roberts wrote: > Xah Lee wrote: > > >(a lil weekend distraction from comp lang!) > > >in recent years, there came this Colemak layout. The guy who created > >it, Colemak, has a site, and aggressively market his layout. It's in > >linuxes distro by default, and has become

Re: multiprocessing Pool.imap broken?

2011-03-31 Thread Yang Zhang
My self-reply tried to preempt your suggestion :) On Wed, Mar 30, 2011 at 12:12 AM, kyle.j.con...@gmail.com wrote: > Yang, > > My guess is that you are running into a problem using multiprocessing with > the interpreter. The documentation states that Pool may not work correctly &g

Re: multiprocessing Pool.imap broken?

2011-03-31 Thread Yang Zhang
The problem was that Pool shuts down from its finalizer: http://stackoverflow.com/questions/5481104/multiprocessing-pool-imap-broken/5481610#5481610 On Wed, Mar 30, 2011 at 5:59 AM, eryksun () wrote: > On Tuesday, March 29, 2011 9:44:21 PM UTC-4, Yang Zhang wrote: >> I've

Re: multiprocessing Pool.imap broken?

2011-03-29 Thread Yang Zhang
On Tue, Mar 29, 2011 at 6:44 PM, Yang Zhang wrote: > I've tried both the multiprocessing included in the python2.6 Ubuntu > package (__version__ says 0.70a1) and the latest from PyPI (2.6.2.1). > In both cases I don't know how to use imap correctly - it causes the > enti

multiprocessing Pool.imap broken?

2011-03-29 Thread Yang Zhang
I've tried both the multiprocessing included in the python2.6 Ubuntu package (__version__ says 0.70a1) and the latest from PyPI (2.6.2.1). In both cases I don't know how to use imap correctly - it causes the entire interpreter to stop responding to ctrl-C's. Any hints? Thanks in advance. $ pytho

Re: Python subprocesses experience mysterious delay in receiving stdin EOF

2011-02-18 Thread Yang Zhang
riter FD - as long as p2 exists, p1 won't see EOF Turns out there's a `close_fds` parameter to `Popen`, so the solution is to pass `close_fds=True`. All simple and obvious in hindsight, but still managed to cost at least a couple eyeballs good chunks of time. On Sun, Feb 13, 2011 at 11:52 PM

Re: Python subprocesses experience mysterious delay in receiving stdin EOF

2011-02-13 Thread Yang Zhang
Anybody else see this issue? On Thu, Feb 10, 2011 at 10:37 AM, Yang Zhang wrote: > On Thu, Feb 10, 2011 at 12:28 AM, Jean-Michel Pichavant > wrote: >> Yang Zhang wrote: >>> >>> On Wed, Feb 9, 2011 at 11:01 AM, MRAB wrote: >>> >>>> >>>

Re: Python subprocesses experience mysterious delay in receiving stdin EOF

2011-02-09 Thread Yang Zhang
On Thu, Feb 10, 2011 at 12:28 AM, Jean-Michel Pichavant wrote: > Yang Zhang wrote: >> >> On Wed, Feb 9, 2011 at 11:01 AM, MRAB wrote: >> >>> >>> On 09/02/2011 01:59, Yang Zhang wrote: >>> >>>> >>>> I reduced a problem I was

Re: Python subprocesses experience mysterious delay in receiving stdin EOF

2011-02-09 Thread Yang Zhang
On Wed, Feb 9, 2011 at 11:01 AM, MRAB wrote: > On 09/02/2011 01:59, Yang Zhang wrote: >> >> I reduced a problem I was seeing in my application down into the >> following test case. In this code, a parent process concurrently >> spawns 2 (you can spawn more) subproces

Python subprocesses experience mysterious delay in receiving stdin EOF

2011-02-08 Thread Yang Zhang
ts: t.start() for t in ts: t.join() Example output: 0.001 0 starting 0.003 1 starting 0.005 0 writing 0.016 1 writing 0.093 0 closing 0.093 0 reading 0.094 1 closing 0.094 1 reading 0.098 .. 1 done reading 5.103 1 done 5.108 .. 0 done reading 10.113 0 done -- Yang Zhang http://yz.mit.edu/ -- http://mail.python.org/mailman/listinfo/python-list

problems on installing PyGTK in Windows XP

2009-10-21 Thread Yang
Python 2.6.3 is installed on my Windows XP throught the binary file provided by Python.org. Then I followed the steps described here: http://faq.pygtk.org/index.py?req=show&file=faq21.001.htp to install PyGTK. However, I still get the following error: >>> import pygtk >>> pygtk.require('2.0') >>>

Re: error when using Pmw.BLT

2009-10-21 Thread Yang
On Oct 21, 12:13 pm, Robert Kern wrote: > On 2009-10-21 10:50 AM, Yang Yang wrote: > > > > > Hello, > > > I tried to follow the following code demonstrating the use of Pmw.BLT: > > >  >>> from Tkinter import * > >  >>> import Pmw > &g

error when using Pmw.BLT

2009-10-21 Thread Yang Yang
Hello, I tried to follow the following code demonstrating the use of Pmw.BLT: >>> from Tkinter import * >>> import Pmw >>> master = Tk() >>> g = Pmw.Blt.Graph( master ) I got the following error message after I typed the last line: Traceback (most recent call last): File "", line 1, in File

error when using Pmw.BLT

2009-10-21 Thread Yang
I tried to follow the following code demonstrating the use of Pwm.BLT: >>> from Tkinter import * >>> import Pmw >>> master = Tk() >>> g = Pmw.Blt.Graph( master ) I got the following error message after I typed the last line: Traceback (most recent call last): File "", line 1, in File "C:\Py

dict would be very slow for big data

2009-05-11 Thread forrest yang
hi i am trying to insert a lot of data into a dict, which may be 10,000,000 level. after inserting 10 unit, the insert rate become very slow, 50,000/ s, and the entire time used for this task would be very long,also. would anyone know some solution for this case? thanks -- http://mail.python.

dict is really slow for big truck

2009-05-01 Thread forrest yang
i try to load a big file into a dict, which is about 9,000,000 lines, something like 1 2 3 4 2 2 3 4 3 4 5 6 code for line in open(file) arr=line.strip().split('\t') dict[arr[0]]=arr but, the dict is really slow as i load more data into the memory, by the way the mac i use have 16G memory.

Re: psycopg2 weirdness

2009-01-19 Thread Yang Zhang
tringobject.c, line 107. Abort trap with a pop that says: "The application Python quit unexpectedly. The problem may have been caused by the _psycopg.so plug-in". -- I don't understand the error message above. The date did get passed correctly and am now not even using it, I use the hard coded date. So what is going on? Any help would be great. Thank you! Neha -- http://mail.python.org/mailman/listinfo/python-list -- Yang Zhang http://www.mit.edu/~y_z/ -- http://mail.python.org/mailman/listinfo/python-list

python3.0 base64 error

2009-01-17 Thread yang michael
I use base64 module on python3.0 like: import base64 b="hello world" a=base64.b64encode(b) print(a) but when i run it,it catch a error: Traceback (most recent call last): File "/home/jackie-yang/yd5m19/pythonstudy/test.py", line 4, in a=base64.b64encode(b) File "

some question about python2.6 and python3k

2009-01-04 Thread Michael Yang
Hi,guys i am a new guy for python world,i have some question want to ask 1.should i learn about python2.6 or python3k?i heard of it has some difference from them 2.Do python3k has some good web framework(like web.py)? Thanks ! -- http://mail.python.org/mailman/listinfo/python-list

Re: py2exe, PyQT, QtWebKit and jpeg problem

2008-06-29 Thread yang . zengguang
On 6月20日, 下午11时04分, Carbonimax <[EMAIL PROTECTED]> wrote: > hello > > I have a problem with py2exe and QtWebKit : > I make a program with a QtWebKit view. > If I launch the .py directly, all images (jpg, png) are displayed but > if I compile it with py2exe I have only png images. No jpg ! > No erro

Unbuffered stdout/auto-flush

2008-06-21 Thread Yang Zhang
Hi, is there any way to get unbuffered stdout/stderr without relying on the -u flag to python or calling .flush() on each print (including indirect hacks like replacing sys.stdout with a wrapper that succeeds each write() with a flush())? Thanks in advance! -- Yang Zhang http://www.mit.edu

os.system() not returning

2007-11-14 Thread Yang
I have a Python program that does the following (pseudo-code): while True: is_downloading = True use ftplib to download any new files from a server is_downloading = False os.system('make') sleep(60) To deal with intermittent connectivity/failures (this is running on a mobile device), /e

Re: Closing socket file descriptors

2007-05-20 Thread Yang
eadable( self ): ... "js " <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > Hello, Yang. > > You're not supposed to use os.open there. > See the doc at http://docs.python.org/lib/os-fd-ops.html > > Is there any reason you want to use os.close? > >

Closing socket file descriptors

2007-05-19 Thread Yang
Hi, I'm experiencing a problem when trying to close the file descriptor for a socket, creating another socket, and then closing the file descriptor for that second socket. I can't tell if my issue is about Python or POSIX. In the following, the first time through, everything works. On the sec

reading argv argument of unittest.main()

2007-05-10 Thread winston . yang
I've read that unittest.main() can take an optional argv argument, and that if it is None, it will be assigned sys.argv. Is there a way to pass command line arguments through unittest.main() to the setUp method of a class derived from unittest.TestCase? Thank you in advance. Winston -- http://

using PyUnit to test with multiple threads

2007-03-28 Thread winston . yang
Is it possible to use PyUnit to test with multiple threads? I want to send many commands to a database at the same time. The order of execution of the commands is indeterminate, and therefore, so is the status message returned. For example, say that I send the commands "get" and "delete" for a gi

Determining cause of termination

2007-03-16 Thread Yang
ssible what happened? For starters, I'm now checking exit status and periodically running 'top' to monitor memory consumption, but are there any other ideas? Thanks in advance, Yang -- http://mail.python.org/mailman/listinfo/python-list

Re: Assertion failure on hotshot.stats.load()

2006-10-27 Thread Yang
;"" error i get: Traceback (most recent call last): File "/home/yang/local/bin/profile.py", line 611, in ? run('execfile(%r)' % (sys.argv[0],), options.outfile, options.sort) File "/home/yang/local/bin/profile.py", line 72, in run prof = prof

Re: Assertion failure on hotshot.stats.load()

2006-10-27 Thread Yang
I fell back onto the old profile module, but got the following error when trying to use zope.interface. I am now without any way to profile my application. Traceback (most recent call last): File "/home/yang/local/bin/profile.py", line 611, in ? run('execfile(%r)

Assertion failure on hotshot.stats.load()

2006-10-27 Thread Yang
Note: I realize hotshot is obsoleted by cProfile, but 2.5 breaks several packages I depend on. I'm using Python 2.4.3. I'm getting an AssertionError on "assert not self._stack" when calling hotshot.stats.load() on my app's hotshot profile. The app consistently causes hotshot to generate such a pro

Python 2.5 "make install" bug?

2006-10-10 Thread Yang Zhang
All the site-packages/*.so files get copied to the directory specified in my ~/.pydistutils.cfg instead of lib-dynload under the prefix dir, then proceeds to chmod 755 all the files in that directory (including ones that existed before install). Please advise. -- http://mail.python.org/mailman/lis

Re: How to download a web page just like a web browser do ?

2006-08-24 Thread Bo Yang
Thank you , Max ! I think HarvestMan is just what I need ! Thanks again ! -- http://mail.python.org/mailman/listinfo/python-list

How to download a web page just like a web browser do ?

2006-08-23 Thread Bo Yang
Hi , It is about one month passed since I post to this list last time . Yes , I use python , I used it in every day normal work , whenever I need to do some scripts or other little-scale works , python is the first one I took consideration in . I must say it is a powerful tool for me , and wha

PyImport_Import() failed

2006-08-02 Thread Yang Fan
Hello,   I'm new to Python.I want to embed Python interpreter into my C++ application powered by Borland C++ Builder 2006.   I have written some C++ code in order to evaluate Python script file, but PyImport_Import() calls failed.I really don't know what's wrong with my cpp code.It always return a

How do you use this list ?

2006-06-27 Thread Bo Yang
Hi everyone , I have join this list for about 4 months , and everyday I receive hundreds of mails . There is no means to read all of them , so I just read something interesting for me . But if so , there are too much mails pile up in my inbox , I want to ask how do you use this list , reading every

Re: Python or Ajax?

2006-06-12 Thread Bo Yang
I think if you know java language very well but feel suffering with the error prone javascript , GWT is good choose for AJAX development . With the well-known IDE Eclipse your development time efficiency will promote fast ! -- http://mail.python.org/mailman/listinfo/python-list

Re: An error ?

2006-06-12 Thread Bo Yang
It works , thank you everyone ! I think there is much more I need to learn before I can grasp a full understand of the C/S modle ! Thanks again ! -- http://mail.python.org/mailman/listinfo/python-list

An error ?

2006-06-11 Thread Bo Yang
Hi , I am confronted with an odd question in the python cgi module ! Below is my code : import cgitb ; cgitb.enable() import cgi print "Hello World !" How easy the script is , and the url is 202.113.239.51/vote/cgi/a.py but apache give me a 'Server internal error !' and the error log is : [Fr

Re: An algorithm problem

2006-05-31 Thread Bo Yang
rd Bo Yang #This is the file for the solution of the 0-1 ring problem #in the csdn algorithm forum #The input to this program is a integer n , #The ouuput of the algorithm is the a list of 2^n elements #in which every number in the range of 0~2^n-1 just appear #once exactly . flag = 0# wheth

Re: An algorithm problem

2006-05-31 Thread Bo Yang
as a ring , and fetch any continuous 2 numbers from it , finally get four combinations : 11 , 10 , 00 , 01 and they are 3 , 2 , 0 , 1 . I hope this time it is clear for all to understand what problem confront me . And again I am sorry for the trouble , thanks for you again ! Best Regard Bo

An algorithm problem

2006-05-30 Thread Bo Yang
Hi , I have writen a python program to slove a problem described as below: (Forgive my poor English !) Put the 2^n 0 or 1 to form a ring , and we can select any continuous n ones from the ring to constitute a binary number . And obviously we can get 2^n selections , so the question is : Given a n

Re: reusing parts of a string in RE matches?

2006-05-10 Thread Bo Yang
John Salerno 写道: > I probably should find an RE group to post to, but my news server at > work doesn't seem to have one, so I apologize. But this is in Python > anyway :) > > So my question is, how can find all occurrences of a pattern in a > string, including overlapping matches? I figure it ha

Re: Kross - Start of a Unified Scripting Approach

2006-04-15 Thread Bo Yang
RM 写道: > This is from the new KOffice Announcement. > > http://www.koffice.org/announcements/announce-1.5.php > > '''This version of KOffice features a start of a unified scripting > solution called Kross. Kross provides cross-language support for > scripting (thus its name) and at present supports

Re: A question about the urllib2 ?

2006-04-14 Thread Bo Yang
Serge Orlov 写道: > Bo Yang wrote: > >> Hi , >> Recently I use python's urllib2 write a small script to login our >> university gateway . >> Usually , I must login into the gateway in order to surf the web . So , >> every time I >> start my co

Re: A question about the urllib2 ?

2006-04-12 Thread Bo Yang
Fuzzyman 写道: > Bo Yang wrote: > >> Hi , >> Recently I use python's urllib2 write a small script to login our >> university gateway . >> Usually , I must login into the gateway in order to surf the web . So , >> every time I >> start my computer ,

A question about the urllib2 ?

2006-04-11 Thread Bo Yang
Hi , Recently I use python's urllib2 write a small script to login our university gateway . Usually , I must login into the gateway in order to surf the web . So , every time I start my computer , it is my first thing to do that open a browser to login the gateway ! So , I decide to write such a s

How can I get the text under the cusor ?

2006-04-06 Thread Bo Yang
Hello , I want to develop an application to record some of the best words and ideas in the web when I surfing with the Firefox or IE . I would like the application have such a GUI : 1.it appear in the system tray area in the Windows ; 2.whenever I select some words (ether in an IE or MS word),I hop

Re: Learning different languages

2006-03-08 Thread Bo Yang
Rich said : > Hi, > > (this is a probably a bit OT here, but comp.lang seems rather > desolated, so I'm not sure I would get an answer there. And right now > I'm in the middle of learning Python anyway so...) > > Anyway, my question is: what experience you people have with working > with different

Re: do design patterns still apply with Python?

2006-03-04 Thread Bo Yang
Paul Novak : > A lot of the complexity of design patterns in Java falls away in > Python, mainly because of the flexibility you get with dynamic typing. > I agree with this very much ! In java or C++ or all such static typing and compiled languages , the type is fixed on in the compile phrase ,

Re: do design patterns still apply with Python?

2006-03-04 Thread Bo Yang
Paul Novak 写道: > A lot of the complexity of design patterns in Java falls away in > Python, mainly because of the flexibility you get with dynamic typing. > I agree with this very much ! In java or C++ or all such static typing and compiled languages , the type is fixed on in the compile phrase ,

make a class instance from a string ?

2006-02-23 Thread Bo Yang
Hi, I know in java , we can use class.ForName("classname") to get an instance of the class 'classname' from a string , in python , how do I do that ? Thanks in advance ! -- http://mail.python.org/mailman/listinfo/python-list

Re: How many web framework for python ?

2006-02-18 Thread Bo Yang
Thank you very much ! -- http://mail.python.org/mailman/listinfo/python-list

How many web framework for python ?

2006-02-17 Thread Bo Yang
Hello everybody , I am a student major in software engeering . I need to do something for my course . There are very good web framework for java and ruby , Is there one for python ? I want to write a web framework for python based on mod_python as my course homework , could you give some advise ?

about Frame.__init__(self)

2005-04-27 Thread yang
.. the line "Frame.__init__(self)" puzzle me. why use it like this? can some one explain it? regards, yang -- http://mail.python.org/mailman/listinfo/python-list

about Frame.__init__(self)

2005-04-27 Thread yang
.. the line "Frame.__init__(self)" puzzle me. why use it like this? can some one explain it? regards, yang -- http://mail.python.org/mailman/listinfo/python-list

Python v.s. c++

2005-02-10 Thread xiaobin yang
Hi, if i am already skillful with c++. Is it useful to learn python? thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: spawn* or exec* and fork, what should I use and how ?

2004-12-15 Thread Lingyun Yang
Peter Hansen wrote: Lingyun Yang wrote: I want to use python as a "shell like" program, and execute an external program in it( such as mv, cp, tar, gnuplot) os.execv("/bin/bash",("/usr/bin/gnuplot",'-c "gnuplot < plot.tmp"')) I would sugges

spawn* or exec* and fork, what should I use and how ?

2004-12-15 Thread Lingyun Yang
Hi, I want to use python as a "shell like" program, and execute an external program in it( such as mv, cp, tar, gnuplot) I tried: os.execv("/bin/bash",("/usr/bin/gnuplot",'-c "gnuplot < plot.tmp"')) since it's in a for-loop, it should be executed many times, but It exits after the first time runn