Re: ANN: pyparsing 1.5.1 released

2008-10-20 Thread Terry Reedy
Rob Williscroft wrote: AIUI the idea is that you write your 2.x python code (and tests) so that when they are processed by 2to3.py you get valid python 3.x code that will pass all its tests. You then maintain your 2.x code base adding another test where the code (and tests) is run through

Re: ANN: pyparsing 1.5.1 released

2008-10-20 Thread Marc 'BlackJack' Rintsch
On Mon, 20 Oct 2008 13:54:56 +0800, oyster wrote: but the pyparsing.py in pyparsing-1.5.1.tar.gz is marked as 2008-10-02 I think it is good too touch all the files' time up-to-date. Why? This throws away information, such as when was package/module xy changed. Ciao, Marc

Re: Python certification

2008-10-20 Thread olive
Certification prooves you're an idiot who needs to spend money to work for another idiot who doesn't know enough about programming to know if they hire competent programmers and need an idiot paper to make them feel better and sleep better at night. So true ! +1 QOTW --

Re: Emacs users: feedback on diffs between python-mode.el and python.el?

2008-10-20 Thread Bruno Desthuilliers
Sebastian Wiesner a écrit : At Thu, 16 Oct 2008 18:21:38 +0200 wrote Bruno Desthuilliers [EMAIL PROTECTED]: It doesn't look like there's any way to browse the subversion any more, though. Doh :( Is there any way to get this version then ??? svn co

Re: regexp in Python (from Perl)

2008-10-20 Thread Bruno Desthuilliers
MRAB a écrit : On Oct 19, 5:47 pm, Bruno Desthuilliers [EMAIL PROTECTED] wrote: Pat a écrit : (snip) ip = ip[ :-1 ] ip =+ '9' or: ip = ip[:-1]+9 (snip) re.sub(r'^(((\d+)\.){3})\d+$', \g19, 192.168.1.1) '192.168.1.9' re.sub(r'^(((\d+)\.){3})\d+$', \g19, 192.168.1.100) '192.168.1.9'

dumping in destructor

2008-10-20 Thread Митя
I have a class which I want to save it's data automatically on disc, when it's destroyed. I have following code: from cPickle import dump class __Register(object): def __init__(self): self.dict = {} def __del__(self): fh = open('aaa', 'w') dump(self.dict, fh)

Python script + v4lctl

2008-10-20 Thread Gatis
Hello! Intro: I wrote script that in case of some event takes picture using usb webcam [Creative Live! Cam Vista IM (VF0420)] and command line utility v4lctl (from package xawtv). Problem1: To catch error and info messages from script I used: sys.stdout = open('/tmp/log','a')

Re: dumping in destructor

2008-10-20 Thread Marc 'BlackJack' Rintsch
On Mon, 20 Oct 2008 01:12:06 -0700, Митя wrote: I have a class which I want to save it's data automatically on disc, when it's destroyed. I have following code: from cPickle import dump class __Register(object): def __init__(self): self.dict = {} def __del__(self):

Re: indentation

2008-10-20 Thread Bruno Desthuilliers
Steven D'Aprano a écrit : On Sun, 19 Oct 2008 19:03:29 +0200, Bruno Desthuilliers wrote: Steven D'Aprano a écrit : (snip) You can use tabs, or spaces. If you use spaces, you can choose 4 spaces, or 8, or any number, By all means, make it 4 spaces - that's the standard. It's *a* standard.

what's the python for this C statement?

2008-10-20 Thread Michele
Hi there, I'm relative new to Python and I discovered that there's one single way to cycle over an integer variable with for: for i in range(0,10,1) which is equivalent to: for (i = 0; i 10; i++) However, how this C statement will be translated in Python? for (j = i = 0; i (1 H); i++)

Re: dumping in destructor

2008-10-20 Thread Michele Simionato
On Oct 20, 10:12 am, Митя [EMAIL PROTECTED] wrote: But when g_register is being destroyed, dump seems to be already dead, so I get: Exception exceptions.TypeError: 'NoneType' object is not callable in bound method __Register.__del__ of MyWiki.Register.__Register object at 0x835a74c ignored

Re: what's the python for this C statement?

2008-10-20 Thread Chris Rebert
On Mon, Oct 20, 2008 at 2:56 AM, Michele [EMAIL PROTECTED] wrote: Hi there, I'm relative new to Python and I discovered that there's one single way to cycle over an integer variable with for: for i in range(0,10,1) Actually, you want: for i in range(10): Since starting at 0 and using a step

Re: What's the perfect (OS independent) way of storing filepaths ?

2008-10-20 Thread Duncan Booth
Steven D'Aprano [EMAIL PROTECTED] wrote: On Sun, 19 Oct 2008 15:40:32 +, Duncan Booth wrote: Steven D'Aprano [EMAIL PROTECTED] wrote: In Linux, config files should go into: ~/.appname/ or /etc/appname/ In Windows (which versions?) then should go into the Documents And Settings

Re: [Python-Dev] Python 2.5.3: call for patches

2008-10-20 Thread Jeroen Ruigrok van der Werven
Martin, -On [20081007 09:27], Martin v. Löwis ([EMAIL PROTECTED]) wrote: Within a few weeks, we will release Python 2.5.3. This will be the last bug fix release of Python 2.5, afterwards, future releases of 2.5 will only include security fixes, and no binaries (for Windows or OSX) will be

Re: dumping in destructor

2008-10-20 Thread Hrvoje Niksic
Митя [EMAIL PROTECTED] writes: I have a class which I want to save it's data automatically on disc, when it's destroyed. I have following code: from cPickle import dump class __Register(object): def __init__(self): self.dict = {} def __del__(self): fh =

Re: what's the python for this C statement?

2008-10-20 Thread Hrvoje Niksic
Michele [EMAIL PROTECTED] writes: Hi there, I'm relative new to Python and I discovered that there's one single way to cycle over an integer variable with for: for i in range(0,10,1) Please use xrange for this purpose, especially with larger iterations. range actually allocates a sequence.

Question related to wx and dynamically updating windows

2008-10-20 Thread Andy
I want to dynamically update a list of elements shown as a checkbox list. A file is used to store the elements, and elements can be added and deleted from the list. The trouble is that the window is not properly updated after deleting/adding items. I use the Detach()/Destroy() to remove the

Re: a question about Chinese characters in a Python Program

2008-10-20 Thread Paul Boddie
On 20 Okt, 07:32, est [EMAIL PROTECTED] wrote: Personally I call it a serious bug in python Normally I'd entertain the possibility of bugs in Python, but your reasoning is a bit thin (in http://bugs.python.org/issue3648): Why cann't Python just define ascii to range(256) I do accept that it

Idenfity numbers in variables

2008-10-20 Thread Alfons Nonell-Canals
Hello, I have a trouble and I don't know how to solve it. I am working with molecules and each molecule has a number of atoms. I obtain each atom spliting the molecule. Ok. It is fine and I have no problem with it. The problem is when I have to work with these atoms. These atoms usually are only

Re: indentation

2008-10-20 Thread Bruno Desthuilliers
Ross Ridge a écrit : Bruno Desthuilliers [EMAIL PROTECTED] wrote: I can't remember having seen any other standard so far. I've seen various indentation styles used in examples on this newsgroup. I meant: in a real-life project. -- http://mail.python.org/mailman/listinfo/python-list

Re: better scheduler with correct sleep times

2008-10-20 Thread Lie
On Oct 19, 4:01 am, sokol [EMAIL PROTECTED] wrote: I started googling for scheduler and found one in standard library but ih has the same code as mine (it calls the  functions in the right order and my doesn't, but it still waits too long). The other schedulers from web are dealing

Re: default value in __init__

2008-10-20 Thread Bruno Desthuilliers
David C. Ullrich a écrit : In article [EMAIL PROTECTED], Bruno Desthuilliers [EMAIL PROTECTED] wrote: (snip) Well... How to say.. Is there any chance these people will read anything *at all* ? No. That's exactly the point! Yeps. But I don't think we derive the same conclusions from that

Re: Idenfity numbers in variables

2008-10-20 Thread John Machin
On Oct 20, 10:16 pm, Alfons Nonell-Canals [EMAIL PROTECTED] wrote: Hello, I have a trouble and I don't know how to solve it. I am working with molecules and each molecule has a number of atoms. I obtain each atom spliting the molecule. Ok. It is fine and I have no problem with it. The

Re: dumping in destructor

2008-10-20 Thread Митя
Thank you for your answers! my g_register is a global object, and it lives all the program's lifetime, so 'with' is not appliable. Am I right? I tried to use atexit and wrote following: class _Register(object): def dump(self): class Registerable(object): g_register =

Re: What's the perfect (OS independent) way of storing filepaths ?

2008-10-20 Thread Ross Ridge
Stef Mientki wrote: Duncan, in windows it's begin to become less common to store settings in DocsSettings, because these directories are destroyed by roaming profiles (a big reason why I can't run Picassa ;-( It's more common to follow the portable apps approach, store them in the application

Re: indentation

2008-10-20 Thread Ross Ridge
Bruno Desthuilliers [EMAIL PROTECTED] wrote: I can't remember having seen any other standard so far. Ross Ridge a écrit : I've seen various indentation styles used in examples on this newsgroup. Bruno Desthuilliers [EMAIL PROTECTED] wrote: I meant: in a real-life project. So? There's no

Re: Idenfity numbers in variables

2008-10-20 Thread Peter Otten
Alfons Nonell-Canals wrote: I have a trouble and I don't know how to solve it. I am working with molecules and each molecule has a number of atoms. I obtain each atom spliting the molecule. Ok. It is fine and I have no problem with it. The problem is when I have to work with these atoms.

Re: Idenfity numbers in variables

2008-10-20 Thread Tim Chase
atom = 'C1' if '1' in atom: print 'kk' But, how can I do to identify in '1' all possibilities from 1-9, I tried: if '[1-9]', \d,... You're reaching in the right direction (regexps), so just use Python's re module: import re digit = re.compile(r'\d') # or [0-9] for test in

Re: indentation

2008-10-20 Thread Duncan Booth
Bruno Desthuilliers [EMAIL PROTECTED] wrote: Ross Ridge a écrit : Bruno Desthuilliers [EMAIL PROTECTED] wrote: I can't remember having seen any other standard so far. I've seen various indentation styles used in examples on this newsgroup. I meant: in a real-life project. When I

Re: indentation

2008-10-20 Thread Paul Boddie
On 20 Okt, 14:24, Duncan Booth [EMAIL PROTECTED] wrote: Those were the only two suggestions given for Python projects with tabs as a coding style. I don't know if the first of these has more than 1 developer, the second lists 7 people as contributors. So it looks like real-life projects do

Re: Python certification

2008-10-20 Thread Eric Wertman
On Mon, Oct 20, 2008 at 3:52 AM, olive [EMAIL PROTECTED] wrote: Certification prooves you're an idiot who needs to spend money to work for another idiot who doesn't know enough about programming to know if they hire competent programmers and need an idiot paper to make them feel better and

Re: What's the perfect (OS independent) way of storing filepaths ?

2008-10-20 Thread Steven D'Aprano
On Sun, 19 Oct 2008 20:50:46 +0200, Stef Mientki wrote: Duncan, in windows it's begin to become less common to store settings in DocsSettings, because these directories are destroyed by roaming profiles (a big reason why I can't run Picassa ;-( It's more common to follow the portable apps

Re: Idenfity numbers in variables

2008-10-20 Thread Paul McGuire
On Oct 20, 7:07 am, Peter Otten [EMAIL PROTECTED] wrote: Alfons Nonell-Canals wrote: I have a trouble and I don't know how to solve it. I am working with molecules and each molecule has a number of atoms. I obtain each atom spliting the molecule. Ok. It is fine and I have no problem with

Re: re.search over a list

2008-10-20 Thread Pat
Bruno Desthuilliers wrote: Pat a écrit : While I can use a for loop looking for a match on a list, I was wondering if there was a one-liner way. In particular, one of my RE's looks like this '^somestring$' so I can't just do this: re.search( '^somestring$', str( mylist ) ) I'm not smart

Re: regexp in Python (from Perl)

2008-10-20 Thread Pat
Bruno Desthuilliers wrote: Pat a écrit : I have a regexp in Perl that converts the last digit of an ip address to '9'. This is a very particular case so I don't want to go off on a tangent of IP octets. ( my $s = $str ) =~ s/((\d+\.){3})\d+/${1}9/ ; While I can do this in Python which

Re: indentation

2008-10-20 Thread Steven D'Aprano
On Mon, 20 Oct 2008 11:01:19 +0200, Bruno Desthuilliers wrote: Steven D'Aprano a écrit : On Sun, 19 Oct 2008 19:03:29 +0200, Bruno Desthuilliers wrote: Steven D'Aprano a écrit : (snip) You can use tabs, or spaces. If you use spaces, you can choose 4 spaces, or 8, or any number, By all

Unicode (UTF8) in dbhas on 2.5

2008-10-20 Thread Yves Dorfsman
Can you put UTF-8 characters in a dbhash in python 2.5 ? It fails when I try: #!/bin/env python # -*- coding: utf-8 -*- import dbhash db = dbhash.open('dbfile.db', 'w') db[u'smiley'] = u'☺' db.close() Do I need to change the bsd db library, or there is no way to

Re: a question about Chinese characters in a Python Program

2008-10-20 Thread est
On Oct 20, 6:47 pm, Paul Boddie [EMAIL PROTECTED] wrote: On 20 Okt, 07:32, est [EMAIL PROTECTED] wrote: Personally I call it a serious bug in python Normally I'd entertain the possibility of bugs in Python, but your reasoning is a bit thin (inhttp://bugs.python.org/issue3648):Why cann't

XML parser

2008-10-20 Thread RC
By default the document = xml.dom.minidom.parse(inputFileName.xml) This will convert all the amp; to But I want to convert the back to amp; Is there a module or method in Python? I know there is such method in PHP, but I am new in Python. Thanks! --

Re: What's the perfect (OS independent) way of storing filepaths ?

2008-10-20 Thread Steven D'Aprano
On Mon, 20 Oct 2008 10:20:06 +, Duncan Booth wrote: Steven D'Aprano [EMAIL PROTECTED] wrote: On Sun, 19 Oct 2008 15:40:32 +, Duncan Booth wrote: Steven D'Aprano [EMAIL PROTECTED] wrote: In Linux, config files should go into: ~/.appname/ or /etc/appname/ In Windows (which

Re: XML parser

2008-10-20 Thread Diez B. Roggisch
RC wrote: By default the document = xml.dom.minidom.parse(inputFileName.xml) This will convert all the amp; to But I want to convert the back to amp; Is there a module or method in Python? I know there is such method in PHP, but I am new in Python. from xml.sax import saxutils

Re: better scheduler with correct sleep times

2008-10-20 Thread sokol
On Oct 20, 1:50 pm, Lie [EMAIL PROTECTED] wrote: On Oct 19, 4:01 am, sokol [EMAIL PROTECTED] wrote: I started googling for scheduler and found one in standard library but ih has the same code as mine (it calls the  functions in the right order and my doesn't, but it still waits too

Re: indentation

2008-10-20 Thread Bruno Desthuilliers
Ross Ridge a écrit : Bruno Desthuilliers [EMAIL PROTECTED] wrote: I can't remember having seen any other standard so far. Ross Ridge a écrit : I've seen various indentation styles used in examples on this newsgroup. Bruno Desthuilliers [EMAIL PROTECTED] wrote: I meant: in a real-life

Re: Unicode (UTF8) in dbhas on 2.5

2008-10-20 Thread Diez B. Roggisch
Yves Dorfsman wrote: Can you put UTF-8 characters in a dbhash in python 2.5 ? It fails when I try: #!/bin/env python # -*- coding: utf-8 -*- import dbhash db = dbhash.open('dbfile.db', 'w') db[u'smiley'] = u'☺' db.close() Do I need to change the

Re: indentation

2008-10-20 Thread Bruno Desthuilliers
Duncan Booth a écrit : Bruno Desthuilliers [EMAIL PROTECTED] wrote: Ross Ridge a écrit : Bruno Desthuilliers [EMAIL PROTECTED] wrote: I can't remember having seen any other standard so far. I've seen various indentation styles used in examples on this newsgroup. I meant: in a real-life

pymssql - execute loads all results into memory!

2008-10-20 Thread ChaosKCW
Hi I am trying to use pymssql, and have an issue where by the execute (not the fetch) is appearing to load all records into memory. if I execute con = pymssql.connect(...) cur = con.cursor() cur.execute(sql) rec = cur.fetchone() if I put in a query which returns a lot of records into sql then

Re: Question related to wx and dynamically updating windows

2008-10-20 Thread Mike Driscoll
On Oct 20, 5:43 am, Andy [EMAIL PROTECTED] wrote: I want to dynamically update a list of elements shown as a checkbox list. A file is used to store the elements, and elements can be added and deleted from the list. The trouble is that the window is not properly updated after deleting/adding

question regarding list comprehensions

2008-10-20 Thread Pat
I have written chunks of Python code that look this: new_array = [] for a in array: if not len( a ): continue new_array.append( a ) and... string = for r in results: if not r.startswith( '#' ): string =+ r It seems that a list

Re: question regarding list comprehensions

2008-10-20 Thread Diez B. Roggisch
Pat wrote: I have written chunks of Python code that look this: new_array = [] for a in array: if not len( a ): continue new_array.append( a ) new_array = [a for a in array if len(a)] and... string = for r in results:

Re: pymssql - execute loads all results into memory!

2008-10-20 Thread Eric Wertman
I am trying to use pymssql, and have an issue where by the execute (not the fetch) is appearing to load all records into memory. if I execute con = pymssql.connect(...) cur = con.cursor() cur.execute(sql) rec = cur.fetchone() if I put in a query which returns a lot of records into sql

Re: What's the perfect (OS independent) way of storing filepaths ?

2008-10-20 Thread Cousin Stanley
[2] And they are right to do so. Programs that dump config files and directories, hidden or not, in the top level of the user's home directory are incredibly rude. It may have been a Unix standard for as long as there has been a Unix, but it's still the programming equivalent of coming

Re: pymssql - execute loads all results into memory!

2008-10-20 Thread Tim Golden
Eric Wertman wrote: I am trying to use pymssql, and have an issue where by the execute (not the fetch) is appearing to load all records into memory. if I execute con = pymssql.connect(...) cur = con.cursor() cur.execute(sql) rec = cur.fetchone() if I put in a query which returns a lot of

Re: dumping in destructor

2008-10-20 Thread Митя
Thanks for your answers! my g_register is a global register, wich contains all my objects and lives all the program lifetime. So 'with' is not appliable. Am I right? But using atexit sounds to be a good solution On Oct 20, 1:58 pm, Michele Simionato [EMAIL PROTECTED] wrote: On Oct 20,

Re: a question about Chinese characters in a Python Program

2008-10-20 Thread Paul Boddie
On 20 Okt, 15:30, est [EMAIL PROTECTED] wrote: Thanks for the long comment Paul, but it didn't help massive errors in Python encoding. IMHO it's even better to output wrong encodings rather than halt the WHOLE damn program by an exception I disagree. Maybe I'll now get round to uploading an

Re: indentation

2008-10-20 Thread Ross Ridge
Bruno Desthuilliers [EMAIL PROTECTED] wrote: I can't remember having seen any other standard so far. I've seen various indentation styles used in examples on this newsgroup. No one bothers to complain when I indent using tabs, or someone else uses 2 space indentation.

Re: dumping in destructor

2008-10-20 Thread robert
Митя wrote: I have a class which I want to save it's data automatically on disc, when it's destroyed. I have following code: from cPickle import dump class __Register(object): def __init__(self): self.dict = {} def __del__(self): fh = open('aaa', 'w')

Re: Question related to wx and dynamically updating windows

2008-10-20 Thread Almar Klein
just to be sure, did you try .Update()? Almar 2008/10/20 Mike Driscoll [EMAIL PROTECTED]: On Oct 20, 5:43 am, Andy [EMAIL PROTECTED] wrote: I want to dynamically update a list of elements shown as a checkbox list. A file is used to store the elements, and elements can be added and deleted

Re: better scheduler with correct sleep times

2008-10-20 Thread Lie
On Oct 19, 4:01 am, sokol [EMAIL PROTECTED] wrote: I started googling for scheduler and found one in standard library but ih has the same code as mine (it calls the  functions in the right order and my doesn't, but it still waits too long). The other schedulers from web are dealing

Re: indentation

2008-10-20 Thread Lie Ryan
On Sun, 19 Oct 2008 07:16:44 -0700, Gandalf wrote: every time I switch editor all the script indentation get mixed up, and python start giving me indentation weird errors. indentation also hard to follow because it invisible unlike brackets { } is there any solution to this problems?

Re: question regarding list comprehensions

2008-10-20 Thread Steven D'Aprano
On Mon, 20 Oct 2008 10:20:03 -0400, Pat wrote: Finally, if someone could point me to a good tutorial or explain list compressions I would be forever in your debt. Think of a for-loop: for x in (1, 2, 3): x Creates x=1, then x=2, then x=3. It doesn't do anything with the x's, but just

Re: indentation

2008-10-20 Thread GHUM
I can't remember having seen any other standard so far. there is this meme flowing around: Thus spake the Lord: Thou shalt indent with four spaces. No more, no less. Four shall be the number of spaces thou shalt indent, and the number of thy indenting shall be four. Eight shalt thou not indent,

Re: regexp in Python (from Perl)

2008-10-20 Thread Bruno Desthuilliers
Pat a écrit : Bruno Desthuilliers wrote: Pat a écrit : I have a regexp in Perl that converts the last digit of an ip address to '9'. This is a very particular case so I don't want to go off on a tangent of IP octets. ( my $s = $str ) =~ s/((\d+\.){3})\d+/${1}9/ ; While I can do this in

Re: re.search over a list

2008-10-20 Thread Bruno Desthuilliers
Pat a écrit : Bruno Desthuilliers wrote: Pat a écrit : While I can use a for loop looking for a match on a list, I was wondering if there was a one-liner way. In particular, one of my RE's looks like this '^somestring$' so I can't just do this: re.search( '^somestring$', str( mylist ) )

Can i use this script as a python evaluator?

2008-10-20 Thread Peter Wang
code #! /bin/sh python -c import sys;exec(sys.stdin) /code Emacs has a function `shell-command-on-region', which takes region as input for the evaluator (script above), and output its result. I have tried and found it works, is there any problems for this, or any other better solution for it?

Re: a question about Chinese characters in a Python Program

2008-10-20 Thread Steven D'Aprano
On Mon, 20 Oct 2008 06:30:09 -0700, est wrote: Like I said, str() should NOT throw an exception BY DESIGN, it's a basic language standard. int() is also a basic language standard, but it is perfectly acceptable for int() to raise an exception if you ask it to convert something into an

Re: windows / unix path

2008-10-20 Thread Larry Bates
Marcin201 wrote: Is there an built-in functionality in python to convert Windows paths to Unix paths? I am running into problems when creating data files on Windows and the running them on a Unix platform. I create paths using os.path.join. os.path.join('Pictures', '01.jpg') returns

Re: Creating single .exe file without py2exe and pyinstaller

2008-10-20 Thread Larry Bates
Tino Wildenhain wrote: Hi, Abah Joseph wrote: I have written a small application of about 40-45 lines which is about 4KB, so I want to create a single .exe file from it, using py2exe it created unnecessary files, that just increase the size of the program and also less portable to me. What

Re: Idenfity numbers in variables

2008-10-20 Thread Lie Ryan
On Mon, 20 Oct 2008 13:16:48 +0200, Alfons Nonell-Canals wrote: Hello, I have a trouble and I don't know how to solve it. I am working with molecules and each molecule has a number of atoms. I obtain each atom spliting the molecule. Ok. It is fine and I have no problem with it. The

Re: a question about Chinese characters in a Python Program

2008-10-20 Thread est
On Oct 20, 11:46 pm, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: On Mon, 20 Oct 2008 06:30:09 -0700, est wrote: Like I said, str() should NOT throw an exception BY DESIGN, it's a basic language standard. int() is also a basic language standard, but it is perfectly acceptable

Re: question regarding list comprehensions

2008-10-20 Thread Bruno Desthuilliers
Pat a écrit : I have written chunks of Python code that look this: new_array = [] for a in array: if not len( a ): continue new_array.append( a ) # à la lisp new_array = filter(None, array) # à la haskell new_array = [a for a in array if a] NB : all

Re: question regarding list comprehensions

2008-10-20 Thread Pat
Steven D'Aprano wrote: On Mon, 20 Oct 2008 10:20:03 -0400, Pat wrote: Finally, if someone could point me to a good tutorial or explain list compressions I would be forever in your debt. Think of a for-loop: for x in (1, 2, 3): x Creates x=1, then x=2, then x=3. It doesn't do anything

Re: a question about Chinese characters in a Python Program

2008-10-20 Thread Lie Ryan
On Sun, 19 Oct 2008 22:32:20 -0700, est wrote: On Oct 20, 10:48 am, Liang Chen [EMAIL PROTECTED] wrote: Hope you all had a nice weekend. I have a question that I hope someone can help me out. I want to run a Python program that uses Tkinter for the user interface (GUI). The program allows

Re: a question about Chinese characters in a Python Program

2008-10-20 Thread Benjamin Kaplan
On Mon, Oct 20, 2008 at 12:44 PM, est [EMAIL PROTECTED] wrote: On Oct 20, 11:46 pm, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: On Mon, 20 Oct 2008 06:30:09 -0700, est wrote: Like I said, str() should NOT throw an exception BY DESIGN, it's a basic language standard.

Re: question regarding list comprehensions

2008-10-20 Thread Pat
Diez B. Roggisch wrote: Pat wrote: I have written chunks of Python code that look this: new_array = [] for a in array: if not len( a ): continue new_array.append( a ) new_array = [a for a in array if len(a)] and... string = for r in

Re: what's the python for this C statement?

2008-10-20 Thread Lie Ryan
On Mon, 20 Oct 2008 12:34:11 +0200, Hrvoje Niksic wrote: Michele [EMAIL PROTECTED] writes: Hi there, I'm relative new to Python and I discovered that there's one single way to cycle over an integer variable with for: for i in range(0,10,1) Please use xrange for this purpose, especially

Python equivalent for C module

2008-10-20 Thread Derek Martin
I'd like to know if it's possible to code something in Python which would be equivalent to the following C: [Assume bool is typedef'd to int, and TRUE and FALSE are #defined to 1 and 0, respectively] debug.c #include stdio.h bool DEBUG; void dprint(char *msg) { if (DEBUG){

Re: Python equivalent for C module

2008-10-20 Thread Gary Herron
Derek Martin wrote: I'd like to know if it's possible to code something in Python which would be equivalent to the following C: [Assume bool is typedef'd to int, and TRUE and FALSE are #defined to 1 and 0, respectively] debug.c #include stdio.h bool DEBUG; void dprint(char

Re: fcgi.py on windows?

2008-10-20 Thread Joshua Kugler
bryan rasmussen wrote: As per the subject, anyone know of a version of fcgi.py out there somewhere that works on windows yet. They might have ported a version for Python 2.6. Versions = 2.5 didn't have a socket.fromfd() on Windows, so FCGI and SCGI wouldn't work. j --

Re: Idenfity numbers in variables

2008-10-20 Thread Duncan Booth
Lie Ryan [EMAIL PROTECTED] wrote: That's the job of regular expression: 'import re' numbered_atom = re.compile('[A-Z][a-z]?[0-9]+') if numbered_atom.match('C10'): # this is a numbered atom if numbered_atom.match('C'): # this WON'T match read more about regular expression on the

Re: a question about Chinese characters in a Python Program

2008-10-20 Thread Terry Reedy
Liang Chen wrote: Hope you all had a nice weekend. I have a question that I hope someone can help me out. I want to run a Python program that uses Tkinter for the user interface (GUI). The program allows me to type Chinese characters, but neverthelss is unable to show them up on screen. The

Re: Python equivalent for C module

2008-10-20 Thread Aaron Brady
On Oct 20, 12:19 pm, Derek Martin [EMAIL PROTECTED] wrote: snip I'm specifically trying to avoid having to create a debug object and pass it around... All modules should have visibility into the state of whether DEBUG is turned on or off, and be able to use dprint().  Can Python do this? I

Python Imaging Library (PIL) question

2008-10-20 Thread Sid
Hi, I am tryin to copy an image into my own data structure(a sort of 2d array for further FFT). I've banged my head over the code for a couple of hours now. The simplified version of my problem is below. #-Code import Image pic =

Using LDAP

2008-10-20 Thread Greg Lindstrom
I am attempting to use python-ldap to connect to our company ldap server. I have downloaded and installed python-ldap 2.3.2 on my Ubuntu system and have been working through the LDAP Programming with Python documentation. I am confused because the documentation states that After an LDAP object

testing...(Sorry)

2008-10-20 Thread Sid
. -- http://mail.python.org/mailman/listinfo/python-list

Wierd problem with python sockets and threading

2008-10-20 Thread thrthr
I have two python applications (more like scripts, they're only about 80 lines each) that are dumbed down http-servers: They accept a connection, reads everything in the socket untill \r\n\r\n and then responds with HTTP/1.1 200 OK\r\n\r\nHello World! and then closes the connection. There is one

Re: Can i use this script as a python evaluator?

2008-10-20 Thread Bruno Desthuilliers
Peter Wang a écrit : code #! /bin/sh python -c import sys;exec(sys.stdin) /code Emacs has a function `shell-command-on-region', which takes region as input for the evaluator (script above), and output its result. I have tried and found it works, is there any problems for this, or any other

Re: indentation

2008-10-20 Thread Terry Reedy
Ross Ridge wrote: Bruno Desthuilliers [EMAIL PROTECTED] wrote: I can't remember having seen any other standard so far. Ross Ridge a écrit : I've seen various indentation styles used in examples on this newsgroup. Bruno Desthuilliers [EMAIL PROTECTED] wrote: I meant: in a real-life

Re: Python certification

2008-10-20 Thread Bruno Desthuilliers
Eric Wertman a écrit : On Mon, Oct 20, 2008 at 3:52 AM, olive [EMAIL PROTECTED] wrote: Certification prooves you're an idiot who needs to spend money to work for another idiot who doesn't know enough about programming to know if they hire competent programmers and need an idiot paper to make

Re: Porting VB apps to Python for Window / Linux use

2008-10-20 Thread Bruno Desthuilliers
Stef Mientki a écrit : Lawrence D'Oliveiro wrote: In message [EMAIL PROTECTED], Dotan Cohen wrote: I often see mention of SMBs that either want to upgrade their Windows installations, or move to Linux, but cannot because of inhouse VB apps. Probably best to leave those legacy VB apps

Abnormal Interpreter Shutdown

2008-10-20 Thread k3xji
Hi all, Is there anyway to detect abnormal interpreter shutdown like (closing from task manager, power shutdown of the PC..etc)? Regards, -- http://mail.python.org/mailman/listinfo/python-list

Re: Porting VB apps to Python for Window / Linux use

2008-10-20 Thread Bruno Desthuilliers
Stef Mientki a écrit : (snip) I'm very satisfied with Python, and must say it's much more beautiful language than Delphi, seen over the full width of programming. Although both languages are Object Oriented, I think you can lowercase those two last words - it's not a religion, you know ?-)

quick newbie syntax question

2008-10-20 Thread Robocop
Is it possible to do something like this syntactically: year = '2008' month = '09' limit = '31' for i in range(1,limit): temp = Table.objects.filter(date = year'-'month'-'i)screwed up syntax ...do something with temp return I know that the syntax within the filter statement is wrong.

Re: quick newbie syntax question

2008-10-20 Thread Chris Rebert
On Mon, Oct 20, 2008 at 12:08 PM, Robocop [EMAIL PROTECTED] wrote: Is it possible to do something like this syntactically: year = '2008' month = '09' limit = '31' for i in range(1,limit): This previous line will fail. range() takes numbers, not strings. Change 'limit' to an int. temp =

Re: Abnormal Interpreter Shutdown

2008-10-20 Thread Tim Golden
k3xji wrote: Hi all, Is there anyway to detect abnormal interpreter shutdown like (closing from task manager, power shutdown of the PC..etc)? Task Manager suggests you're using Windows, on which basis you've got a few options open to you, but fundamentally if someone pulls the plug on the PC

Re: quick newbie syntax question

2008-10-20 Thread Robocop
oops! Sorry about that, i should have just copied my code directly. I actually did specify an int in range: year = '2008' month = '09' limit = '31' for i in range(1,int(limit)): The code is currently failing due to the syntax in the filter, particularly the section date =

Re: Python equivalent for C module

2008-10-20 Thread Bruno Desthuilliers
Derek Martin a écrit : I'd like to know if it's possible to code something in Python which would be equivalent to the following C: [Assume bool is typedef'd to int, and TRUE and FALSE are #defined to 1 and 0, respectively] debug.c #include stdio.h bool DEBUG; void dprint(char *msg)

Re: What's the perfect (OS independent) way of storing filepaths ?

2008-10-20 Thread Bruno Desthuilliers
Eric Wertman a écrit : I (again) wonder what's the perfect way to store, OS-independent, filepaths ? I'm in agreement that perfect probably isn't applicable. If I were doing this myself, I might store the information in a tuple: base = 'some root structure ('/' or 'C') make it C:\ path =

Re: hiding modules in __init__.py

2008-10-20 Thread Chris Rebert
On Sat, Oct 18, 2008 at 12:03 PM, Brendan Miller [EMAIL PROTECTED] wrote: How would I implement something equivalent to java's package private in python? Say if I have package/__init__.py package/utility_module.py and utility_module.py is an implementation detail subject to change. Is

[ANN]pygccxml - 1.0

2008-10-20 Thread Roman Yakovenko
Hello! I'm pleased to announce the 1.0 release of pygccxml. What is pygccxml? === ...The purpose of the GCC-XML extension is to generate an XML description of a C++ program from GCC's internal representation. -- Introduction to GCC-XML The purpose of pygccxml is to read a generated

[ANN] Py++ - 1.0

2008-10-20 Thread Roman Yakovenko
Hello! I'm pleased to announce the 1.0 release of Py++. What is Py++? = Py++ is an object-oriented framework for creating a code generator for Boost.Python library. Where is Py++? == Site: http://language-binding.net/pyplusplus/pyplusplus.html Download:

  1   2   3   >