[issue4653] Patch to fix typos for Py3K

2008-12-18 Thread Johnny Lee
Johnny Lee typo...@gmail.com added the comment: It's difficult to really test such errors. When I can't control the called function, I usually step through the code in a debugger and change the result variable in question to the appropriate value to see if the code handles failed function

[issue4653] Patch to fix typos for Py3K

2008-12-16 Thread Johnny Lee
Changes by Johnny Lee typo...@gmail.com: Removed file: http://bugs.python.org/file12335/py30diff.txt ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4653

[issue4653] Patch to fix typos for Py3K

2008-12-16 Thread Johnny Lee
Johnny Lee typo...@gmail.com added the comment: attached modified diff patch so line length =79 chars Added file: http://bugs.python.org/file12374/py30dif2.txt ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4653

[issue4653] Patch to fix typos for Py3K

2008-12-13 Thread Johnny Lee
Johnny Lee typo...@gmail.com added the comment: Here are the URLs to the MSDN documentation for CreateFileMapping and FormatMessage[A|W]: http://msdn.microsoft.com/en-us/library/aa366537.aspx http://msdn.microsoft.com/en-us/library/ms679351.aspx For CreateFileMapping(), from the Return Value

[issue4653] Patch to fix typos for Py3K

2008-12-13 Thread Johnny Lee
Johnny Lee typo...@gmail.com added the comment: For the dynload_win.c typo, it's technically a possible buffer overflow, but you'd need to find an error that had an error message that's longer than 259 chars. In pythonrun.c, the if statements for fout and ferr and almost identical. Probably

[issue4653] Patch to fix typos for Py3K

2008-12-12 Thread Johnny Lee
New submission from Johnny Lee typo...@gmail.com: I ran my typo.pl perl script that locates possible C/C++ typos. I found four that looked valid. Two of the typos were in the Python directory {pythonrun.c, dynload_win.c}, two were in PC/bdist_wininst {install.c, extract.c}. Python

Why the nonsense number appears?

2005-10-31 Thread Johnny Lee
Hi, Pls take a look at this code: -- t1 = 1130748744 t2 = 461 t3 = 1130748744 t4 = 500 time1 = t1+.+t2 time2 = t3+.+t4 print time1, time2 1130748744.461 1130748744.500 float(time2) - float(time1) 0.03934332275391 Why are there so many nonsense tails? thanks for your

Re: How to translate python into C

2005-10-29 Thread Johnny Lee
Thanks Szabolcs and Laurence, it's not the crash of python but the crash of cygwin. We can locate the line number but when we submit the crash to cygwin's mail list, they told us they don't speak python. So I'm just trying to re-produce the crash in C. Regards, Johnny --

How to translate python into C

2005-10-28 Thread Johnny Lee
Hi, First, I want to know whether the python interpreter translate the code directly into machine code, or translate it into C then into machine code? Second, if the codes are translated directly into machine codes, how can I translate the codes into C COMPLETELY the same? if the codes are

Re: How to translate python into C

2005-10-28 Thread Johnny Lee
Szabolcs Nagy wrote: python creates bytecode (like java classes) you cannot translate python directly to c or machine code, but there are some projects you probably want to look into Pypy is a python implemetation in python and it can be used to translate a python scrip to c or llvm

Re: How to translate python into C

2005-10-28 Thread Johnny Lee
Thanks for your tips Niemann:) Regards, Johnny -- http://mail.python.org/mailman/listinfo/python-list

Re: Question on class member in python

2005-10-21 Thread Johnny Lee
It looks like there isn't a last word of the differrences -- http://mail.python.org/mailman/listinfo/python-list

Re: Question on class member in python

2005-10-18 Thread Johnny Lee
But I still wonder what's the difference between the A().getMember and A().member besides the style -- http://mail.python.org/mailman/listinfo/python-list

Question on class member in python

2005-10-17 Thread Johnny Lee
Class A: def __init__(self): self.member = 1 def getMember(self): return self.member a = A() So, is there any difference between a.member and a.getMember? thanks for your help. :) Regards, Johnny -- http://mail.python.org/mailman/listinfo/python-list

Re: Question on class member in python

2005-10-17 Thread Johnny Lee
Peter Otten 写道: Johnny Lee wrote: Class A: def __init__(self): self.member = 1 def getMember(self): return self.member a = A() So, is there any difference between a.member and a.getMember? thanks for your help. :) Yes. accessor methods for simple

Re: A problem while using urllib

2005-10-14 Thread Johnny Lee
Steve Holden 写道: Good catch, John, I suspect this is a possibility so I've added the following note: The Windows 2.4.1 build doesn't show this error, but the Cygwin 2.4.1 build does still have uncollectable objects after a urllib2.urlopen(), so there may be a platform dependency here. No

Re: A problem while using urllib

2005-10-12 Thread Johnny Lee
Steve Holden wrote: Johnny Lee wrote: Alex Martelli wrote: Johnny Lee [EMAIL PROTECTED] wrote: ... try: webPage = urllib2.urlopen(url) except urllib2.URLError: ... webPage.close() return True

A problem while using urllib

2005-10-11 Thread Johnny Lee
Hi, I was using urllib to grab urls from web. here is the work flow of my program: 1. Get base url and max number of urls from user 2. Call filter to validate the base url 3. Read the source of the base url and grab all the urls from href property of a tag 4. Call filter to validate every url

Re: A problem while using urllib

2005-10-11 Thread Johnny Lee
Alex Martelli wrote: Johnny Lee [EMAIL PROTECTED] wrote: ... try: webPage = urllib2.urlopen(url) except urllib2.URLError: ... webPage.close() return True But every time when I ran to the 70 to 75

A problem while using anygui

2005-09-30 Thread Johnny Lee
Hi, I've met a problem while using anygui to create a GUI. Here is a brief example from Dave: ### def guidialog(): def ok(**kw): win.destroy() app.remove(win) #snip anygui.link(btn_ok, ok) #snip app.run() return n #qtgui will NEVER get here ### As you can see,

Help on regular expression match

2005-09-22 Thread Johnny Lee
Hi, I've met a problem in match a regular expression in python. Hope any of you could help me. Here are the details: I have many tags like this: xxxa href=http://xxx.xxx.xxx; xx xxxa href=wap://xxx.xxx.xxx xx xxxa href=http://xxx.xxx.xxx; xx . And

Re: No newline using printf

2005-09-15 Thread Johnny Lee
Roy Smith wrote: For closer control over output, use the write() function. You want something like: import sys for i in range(3): sys.stdout.write (str(i)) here is the output of my machine: import sys for i in range(3): ... sys.stdout.write(str(i)) ... 012 Why the prompt

An interesting python problem

2005-09-14 Thread Johnny Lee
Hi, Look at the follow command in python command line, See what's interesting?:) class A: i = 0 a = A() b = A() a.i = 1 print a.i, b.i 1 0 --- class A: arr = [] a = A() b = A() a __main__.A instance at 0x00C96698 b __main__.A

Re: An interesting python problem

2005-09-14 Thread Johnny Lee
bruno modulix wrote: I dont see anything interesting nor problematic here. If you understand the difference between class attributes and instance attributes, the difference between mutating an object and rebinding a name, and the attribute lookup rules in Python, you'll find that all this is

Would you pls tell me a tool to step debug python program?

2005-09-12 Thread Johnny Lee
Hi, I've met a problem to understand the code at hand. And I wonder whether there is any useful tools to provide me a way of step debug? Just like the F10 in VC... Thanks for your help. Regards, Johnny -- http://mail.python.org/mailman/listinfo/python-list

Re: What's the difference between VAR and _VAR_?

2005-09-08 Thread Johnny Lee
As what you said, the following two code section is totally the same? (I) class TestResult: _passxxx_ = pass (II) class TestResult: passxxx = pass -- http://mail.python.org/mailman/listinfo/python-list

Re: What's the difference between VAR and _VAR_?

2005-09-08 Thread Johnny Lee
Erik Max Francis wrote: No, of course not. One defines a class varaible named `_passxxx_', the other defines one named `passsxxx'. I mean besides the difference of name... -- http://mail.python.org/mailman/listinfo/python-list

Re: What's the difference between VAR and _VAR_?

2005-09-08 Thread Johnny Lee
Erik Max Francis wrote: You're going to have to be more clear; I don't understand your question. What's the difference between a = 1 and b = 1 besides the difference of name? I thought there must be something special when you named a VAR with '_' the first character.

What's the matter with this code section?

2005-08-24 Thread Johnny Lee
Here is the source: #! /bin/python [EMAIL PROTECTED] This is a xunit test framework for python, see TDD for more details class TestCase: def setUp(self): print setUp in TestCase pass def __init__(self, name): print __init__ in