Re: Generator expressions vs. comprehensions

2010-05-25 Thread Peter Otten
Michele Simionato wrote: > On May 25, 12:47 am, Carl Banks wrote: >> The situation here is known. It can't be corrected, even in Python 3, >> without modifying iterator protocol to tie StopIteration to a specific >> iterator. This is possible and might be worth it to avoid hard-to- >> diagnose

Re: Question on Python Function

2010-05-25 Thread Peter Otten
Kushal Kumaran wrote: > On Tue, May 25, 2010 at 3:38 AM, joy99 wrote: >> >> >> Dear Vlastimir, >> >> As pointed out by Alister, I can print the values of function1 and >> function2 with the help of another function3, but my target is to call >> the "add" value of function1 and "mult" value of fu

Re: Generator expressions vs. comprehensions

2010-05-25 Thread Michele Simionato
On May 25, 9:08 am, Peter Otten <__pete...@web.de> wrote: > But the list comprehension is already non-equivalent to the for loop as the > loop variable isn't leaked anymore. We do have three similar constructs with > subtle differences. > > I think not turning the list-comp into syntactic sugar for

Re: function that counts...

2010-05-25 Thread Jean-Michel Pichavant
superpollo wrote: Jean-Michel Pichavant ha scritto: Jerry Hill wrote: On Wed, May 19, 2010 at 3:58 PM, superpollo wrote: ... how many positive integers less than n have digits that sum up to m: ... any suggestion for pythonizin' it? This is how I would do it: def prttn(m, n

asyncore loop and cmdloop problem

2010-05-25 Thread kak...@gmail.com
Hi to all, i'm creating a command line application using asyncore and cmd. At if __name__ == '__main__': import socket args = sys.argv[1:] if not args: print "Usage: %s querystring" % sys.argv[0] sys.exit(0) address = ('localhost', 0) # let the kernel give us a p

Help regarding XML file manipulation

2010-05-25 Thread Salil GK
Hello I need to make a quick prototype to process some xml file. I found xml.dom.minidom much handy and I can get information from the xml file. But I need to update a filed in the xml file and save the file. I couldn't find a way to do that. Could some one please help me on this. Basically thi

how to run brill tagger on urdu corpus?

2010-05-25 Thread fari
I like to run brill demo function with urdu pos tagged i have urdu corpus reader and a POS tagged file can you help me. 1) how and where i need to define templates for urdu . Is template dat are given with nltk(brill) are compatible to run with urdu. 2) If i want to run brill demo function on urd

Re: asyncore loop and cmdloop problem

2010-05-25 Thread Michele Simionato
On May 25, 10:42 am, "kak...@gmail.com" wrote: > Hi to all, > i'm creating a command line application using asyncore and cmd. At > > if __name__ == '__main__': >     import socket > >     args = sys.argv[1:] >     if not args: >         print "Usage: %s querystring" % sys.argv[0] >         sys.exi

Re: Reading data from a Microsoft Access 2003 database

2010-05-25 Thread Jimoid
This is perfect if the python ODBC driver can read the .mdb without the need for it to be running elsewhere. Thanks all for your help. -- http://mail.python.org/mailman/listinfo/python-list

Re: Help regarding XML file manipulation

2010-05-25 Thread Shashank Singh
On Tue, May 25, 2010 at 2:24 PM, Salil GK wrote: > Hello > > I need to make a quick prototype to process some xml file. I found > xml.dom.minidom much handy and I can get information from the xml file. But > I need to update a filed in the xml file and save the file. I couldn't find > a way to

Re: asyncore loop and cmdloop problem

2010-05-25 Thread kak...@gmail.com
On May 25, 4:55 am, Michele Simionato wrote: > On May 25, 10:42 am, "kak...@gmail.com" wrote: > > > > > Hi to all, > > i'm creating a command line application using asyncore and cmd. At > > > if __name__ == '__main__': > >     import socket > > >     args = sys.argv[1:] > >     if not args: > >  

Re: asyncore loop and cmdloop problem

2010-05-25 Thread Giampaolo Rodolà
2010/5/25 Michele Simionato : > On May 25, 10:42 am, "kak...@gmail.com" wrote: >> Hi to all, >> i'm creating a command line application using asyncore and cmd. At >> >> if __name__ == '__main__': >>     import socket >> >>     args = sys.argv[1:] >>     if not args: >>         print "Usage: %s que

Re: asyncore loop and cmdloop problem

2010-05-25 Thread Michele Simionato
On May 25, 12:03 pm, Giampaolo Rodolà wrote: > Too bad cmdloop() doesn't provide an argument to return immediately. > Why don't you submit this patch on the bug tracker? > > --- Giampaolohttp://code.google.com/p/pyftpdlibhttp://code.google.com/p/psutil Because it is not a bug, cmd was designed to

Re: asyncore loop and cmdloop problem

2010-05-25 Thread Giampaolo Rodolà
2010/5/25 Michele Simionato : > On May 25, 12:03 pm, Giampaolo Rodolà wrote: >> Too bad cmdloop() doesn't provide an argument to return immediately. >> Why don't you submit this patch on the bug tracker? >> >> --- >> Giampaolohttp://code.google.com/p/pyftpdlibhttp://code.google.com/p/psutil > > B

Re: [wxPython-users] wxPython 2.8.11.0 release

2010-05-25 Thread Tom Browder
On Mon, May 24, 2010 at 18:38, Robin Dunn wrote: ... > The 2.8.11.0 release of wxPython is now available for download at > http://wxpython.org/download.php. This release adds Python 2.7 builds, > PySlices, new pubsub implementation, lots of updates to AGW, and lots > of bugs fixed.  A summary of c

Re: function that counts...

2010-05-25 Thread superpollo
Jean-Michel Pichavant ha scritto: superpollo wrote: Jean-Michel Pichavant ha scritto: Jerry Hill wrote: On Wed, May 19, 2010 at 3:58 PM, superpollo wrote: ... how many positive integers less than n have digits that sum up to m: ... any suggestion for pythonizin' it? This is

Re: asyncore loop and cmdloop problem

2010-05-25 Thread kak...@gmail.com
On May 25, 6:48 am, Giampaolo Rodolà wrote: > 2010/5/25 Michele Simionato : > > > On May 25, 12:03 pm, Giampaolo Rodolà wrote: > >> Too bad cmdloop() doesn't provide an argument to return immediately. > >> Why don't you submit this patch on the bug tracker? > > >> --- > >> Giampaolohttp://code.g

Re: A Quick MySQL Question

2010-05-25 Thread Victor Subervi
On Tue, May 25, 2010 at 3:50 AM, Dennis Lee Bieber wrote: > On Mon, 24 May 2010 13:37:58 -0400, Victor Subervi > declaimed the following in >Parameterized queries process the parameters to ensure that they are > safe for use in the SQL statement. > >In the case of the MySQLdb adap

to prevent reveres engineering for Python

2010-05-25 Thread Sandy Ydnas
Agree, reveres engineering is crucial issuer for programming language but every executable file can be cracked, for example by using disassembler!!! For each weapon there is antiweapon, so is it possible to prevent reveres engineering when customer have access to executable made from Python

Re: asyncore loop and cmdloop problem

2010-05-25 Thread Michele Simionato
On May 25, 2:56 pm, "kak...@gmail.com" wrote: > Could you please provide me with a simple example how to do this with > threads. > I don't know where to put the cmdloop(). > Please help, i' m so confused! > Thank you What are you trying to do? Do you really need to use the standard library? Likel

Re: asyncore loop and cmdloop problem

2010-05-25 Thread kak...@gmail.com
On May 25, 5:23 pm, Michele Simionato wrote: > On May 25, 2:56 pm, "kak...@gmail.com" wrote: > > > Could you please provide me with a simple example how to do this with > > threads. > > I don't know where to put the cmdloop(). > > Please help, i' m so confused! > > Thank you > > What are you tryi

Re: to prevent reveres engineering for Python

2010-05-25 Thread Adam Tauno Williams
On Tue, 2010-05-25 at 18:49 +0500, Sandy Ydnas wrote: > Agree, reveres engineering is crucial issuer for programming > language > but every executable file can be cracked, for example by using > disassembler!!! > For each weapon there is antiweapon, so > is it possible to prevent reveres engine

Re: asyncore loop and cmdloop problem

2010-05-25 Thread kak...@gmail.com
On May 25, 5:47 pm, "kak...@gmail.com" wrote: > On May 25, 5:23 pm, Michele Simionato > wrote: > > > On May 25, 2:56 pm, "kak...@gmail.com" wrote: > > > > Could you please provide me with a simple example how to do this with > > > threads. > > > I don't know where to put the cmdloop(). > > > Ple

Re: Generator expressions vs. comprehensions

2010-05-25 Thread Terry Reedy
On 5/25/2010 3:08 AM, Peter Otten wrote: Michele Simionato wrote: I think not turning the list-comp into syntactic sugar for list(genexp) in py3 is a missed opportunity. Implementing it that way was tried but was much slower than the current implementation. If one uses StopIteration as it i

Re: to prevent reveres engineering for Python

2010-05-25 Thread Terry Reedy
On 5/25/2010 9:49 AM, Sandy Ydnas wrote: is it possible to prevent reveres engineering when customer have access to executable made from Python code??? If there is, it is a trade secrets that you will not be able to reverse engineer ;-). -- http://mail.python.org/mailman/listinfo/python-lis

Re: Generator expressions vs. comprehensions

2010-05-25 Thread Terry Reedy
On 5/25/2010 1:09 PM, Terry Reedy wrote: On 5/25/2010 3:08 AM, Peter Otten wrote: Michele Simionato wrote: I think not turning the list-comp into syntactic sugar for list(genexp) in py3 is a missed opportunity. Implementing it that way was tried but was much slower than the current implemen

Troubles with python internationalization

2010-05-25 Thread Pascal Chambon
Hello I'm studying the migration of my website (mixed english and french languages...) to a properly localized architecture. From what I've read so far, using translation "tags" (or quick phrases) in the code, and translating them to every target language (including english) sounds a better appr

Another Little MySQL Problem

2010-05-25 Thread Victor Subervi
Hi; I have this code: clientCursor.execute('select ID from %s' % (personalDataTable)) upds = [itm[0] for itm in clientCursor] print "" % upds The problem is that the values passed are 1L, 2L When I retrieve them on the other end and try to convert them to integers, guess what happ

Legal Point Dhaka bangladesh

2010-05-25 Thread Minhaz Rahman
http://www.advocatemizan.com -- http://mail.python.org/mailman/listinfo/python-list

speed up a numpy code with huge array

2010-05-25 Thread Alexzive
Hello Pythonguys! is there a way to improve the performance of the attached code ? it takes about 5 h on a dual-core (using only one core) when len(V) ~1MIL. V is an array which is supposed to store all the volumes of tetrahedral elements of a grid whose coord. are stored in NN (accessed trough th

UnicodeDecodeError having fetch web page

2010-05-25 Thread Barry
Hi, The code below is giving me the error: Traceback (most recent call last): File "C:\Users\Administratör\Desktop\test.py", line 4, in UnicodeDecodeError: 'utf8' codec can't decode byte 0x8b in position 1: unexpected code byte What am i doing wrong? Thanks, Barry request = urllib.reques

Re: speed up a numpy code with huge array

2010-05-25 Thread Vincent Davis
It makes me think you are filling you available memory and using the disk as cache. If this happens things will get real slow. You might take a look at your system resources when this is running. I don't have much else to offer and could be completely wrong. Vincent On Tue, May 25, 2010 at 1:05 P

Re: UnicodeDecodeError having fetch web page

2010-05-25 Thread Philip Semanchuk
On May 25, 2010, at 3:13 PM, Barry wrote: Hi, The code below is giving me the error: Traceback (most recent call last): File "C:\Users\Administratör\Desktop\test.py", line 4, in UnicodeDecodeError: 'utf8' codec can't decode byte 0x8b in position 1: unexpected code byte What am i doing wr

Re: to prevent reveres engineering for Python

2010-05-25 Thread Lie Ryan
On 05/26/10 01:09, Adam Tauno Williams wrote: > On Tue, 2010-05-25 at 18:49 +0500, Sandy Ydnas wrote: >> Agree, reveres engineering is crucial issuer for programming >> language >> but every executable file can be cracked, for example by using >> disassembler!!! >> For each weapon there is anti

Re: to prevent reveres engineering for Python

2010-05-25 Thread D'Arcy J.M. Cain
On Wed, 26 May 2010 05:40:43 +1000 Lie Ryan wrote: > That merely gives a false sense of security. If the program is decrypted > in memory, you can easily make a memory dump to get the unencrypted > program. If I am a competitor that can make economic advantage by > cracking your secret sauce, it w

Re: Python-list Digest, Vol 80, Issue 223

2010-05-25 Thread Ian Kelly
On Tue, May 25, 2010 at 1:10 PM, wrote: > -- Forwarded message -- > From: Terry Reedy > To: python-l...@python.org > Date: Tue, 25 May 2010 13:09:23 -0400 > Subject: Re: Generator expressions vs. comprehensions > On 5/25/2010 3:08 AM, Peter Otten wrote: >> >> Michele Simionato wr

Re: UnicodeDecodeError having fetch web page

2010-05-25 Thread Barry
On 25 Maj, 21:39, Philip Semanchuk wrote: > On May 25, 2010, at 3:13 PM, Barry wrote: > > > > > Hi, > > > The code below is giving me the error: > > > Traceback (most recent call last): > >  File "C:\Users\Administratör\Desktop\test.py", line 4, in > > UnicodeDecodeError: 'utf8' codec can't decod

Re: to prevent reveres engineering for Python

2010-05-25 Thread Grant Edwards
On 2010-05-25, D'Arcy J.M. Cain wrote: > On Wed, 26 May 2010 05:40:43 +1000 > Lie Ryan wrote: > >> That merely gives a false sense of security. If the program is >> decrypted in memory, you can easily make a memory dump to get the >> unencrypted program. If I am a competitor that can make economi

Re: Python-list Digest, Vol 80, Issue 223

2010-05-25 Thread Chris Rebert
On Tue, May 25, 2010 at 1:01 PM, Ian Kelly wrote: > On Tue, May 25, 2010 at 1:10 PM,   wrote: >> -- Forwarded message -- >> From: Terry Reedy >> To: python-l...@python.org >> Date: Tue, 25 May 2010 13:09:23 -0400 >> Subject: Re: Generator expressions vs. comprehensions >> On 5/25/

Re: UnicodeDecodeError having fetch web page

2010-05-25 Thread Peter Otten
Barry wrote: > On 25 Maj, 21:39, Philip Semanchuk wrote: >> On May 25, 2010, at 3:13 PM, Barry wrote: >> >> >> >> > Hi, >> >> > The code below is giving me the error: >> >> > Traceback (most recent call last): >> > File "C:\Users\Administratör\Desktop\test.py", line 4, in >> > UnicodeDecodeError

Re: UnicodeDecodeError having fetch web page

2010-05-25 Thread Rob Williscroft
Barry wrote in news:83dc485a-5a20-403b-99ee-c8c627bdbab3 @m21g2000vbr.googlegroups.com in gmane.comp.python.general: > Hi, > > The code below is giving me the error: > > Traceback (most recent call last): > File "C:\Users\Administratör\Desktop\test.py", line 4, in > UnicodeDecodeError: 'utf8

Re: UnicodeDecodeError having fetch web page

2010-05-25 Thread Philip Semanchuk
On May 25, 2010, at 4:00 PM, Barry wrote: On 25 Maj, 21:39, Philip Semanchuk wrote: On May 25, 2010, at 3:13 PM, Barry wrote: Hi, The code below is giving me the error: Traceback (most recent call last): File "C:\Users\Administratör\Desktop\test.py", line 4, in UnicodeDecodeError:

Re: to prevent reveres engineering for Python

2010-05-25 Thread Adam Tauno Williams
On Wed, 2010-05-26 at 05:40 +1000, Lie Ryan wrote: > On 05/26/10 01:09, Adam Tauno Williams wrote: > > On Tue, 2010-05-25 at 18:49 +0500, Sandy Ydnas wrote: > >> Agree, reveres engineering is crucial issuer for programming > >> language > >> but every executable file can be cracked, for example

Re: to prevent reveres engineering for Python

2010-05-25 Thread Daniel Fetchinson
>> is it possible to prevent reveres engineering when customer have access >> to executable made from Python code??? The only secure way of protecting your code is if you expose it as a web service or some such. (Yes, people can still crack your web server, but that's nitpicking :)) Cheers, Danie

Re: to prevent reveres engineering for Python

2010-05-25 Thread Ben Finney
Terry Reedy writes: > On 5/25/2010 9:49 AM, Sandy Ydnas wrote: > > > is it possible to prevent reveres engineering when customer have > > access to executable made from Python code??? > > If there is, it is a trade secrets that you will not be able to > reverse engineer ;-). +1 QOTW -- \

Re: asyncore loop and cmdloop problem

2010-05-25 Thread exarkun
On 04:31 pm, kak...@gmail.com wrote: On May 25, 5:47�pm, "kak...@gmail.com" wrote: On May 25, 5:23�pm, Michele Simionato wrote: > On May 25, 2:56�pm, "kak...@gmail.com" wrote: > > Could you please provide me with a simple example how to do this with > > threads. > > I don't know where to

Re: function that counts...

2010-05-25 Thread Bryan
Raymond Hettinger wrote: > If speed is important, the global lookups can be localized: > > def prttn(m, n, map=itertools.imap, int=int, str=str, range=range): >     return sum(m == sum(map(int, str(x))) for x in range(n)) That's just silly. "If speed is important," we abandon the naive algorithm.

Re: function that counts...

2010-05-25 Thread Bryan
Jean-Michel Pichavant wrote: > I still don't see "how many positive integers less than n have digits > that sum up to m" makes it a "partition" though if that what prttn > means. Surely because I miss the context. A partition of a positive integer m is an unordered collection of positive integers

Need some Python 3 help

2010-05-25 Thread Paul McGuire
I was teetering on the brink of releasing Pyparsing 1.5.3 (with some nice new examples and goodies), when I saw that I had recently introduced a bug in the Python 3 compatible version. Here is the stacktrace as reported on SF: Traceback (most recent call last): File "testcase.py", line 11, in re

Re: Need some Python 3 help

2010-05-25 Thread Benjamin Peterson
Paul McGuire austin.rr.com> writes: > In this section of code, instring is a string, loc is an int, and wt > is a string. Any clues why instring[loc] would be evaluating as int? > (I am unfortunately dependent on the kindness of strangers when it > comes to testing my Python 3 code, as I don't ha

Re: Need some Python 3 help

2010-05-25 Thread Bryan
Paul McGuire wrote: [...] > while loc < instrlen and instring[loc] in wt: > TypeError: 'in ' requires string as left operand, not int > > In this section of code, instring is a string, loc is an int, In Python 3, lots of things that used to return str now return bytes, and the elements of a bytes

Re: Need some Python 3 help

2010-05-25 Thread Paul McGuire
On May 25, 8:58 pm, Benjamin Peterson wrote: > Paul McGuire austin.rr.com> writes: > > > In this section of code, instring is a string, loc is an int, and wt > > is a string.  Any clues why instring[loc] would be evaluating as int? > > (I am unfortunately dependent on the kindness of strangers wh

Re: Need some Python 3 help

2010-05-25 Thread Bryan
Paul McGuire wrote: > Hrmm, I had a sneaking hunch this might be the issue.  But then I > don't know how this code *ever* worked in Python 3, as it is chock > full of indexed references into the string being parsed.  And yet, > I've had other folks test and confirm that pyparsing_py3 *does* work >

Re: [wxPython-users] wxPython 2.8.11.0 release

2010-05-25 Thread Godson Gera
On Tue, May 25, 2010 at 5:08 AM, Robin Dunn wrote: > Announcing > -- > > The 2.8.11.0 release of wxPython is now available for download at > http://wxpython.org/download.php. This release adds Python 2.7 builds, > PySlices, new pubsub implementation, lots of updates to AGW, and lots > of

Re: PEP 3119 ABC - And how I learned to love the Abstract Bomb

2010-05-25 Thread Pykler
On May 13, 9:30 am, Lawrence D'Oliveiro wrote: > You’re looking at it wrong. If you want to force people to do things in a > certain way, use Java. Python is about enabling things, not forcing them. LoL :-) > Don’t use subclassing. Instead, let the caller pass you a duck-typed object > that impl

Re: speed up a numpy code with huge array

2010-05-25 Thread draco parvus
On May 26, 7:05 am, Alexzive wrote: > Hello Pythonguys! > > is there a way to improve the performance of the attached code ? it > takes about 5 h on a dual-core (using only one core) when len(V) > ~1MIL. V is an array which is supposed to store all the volumes of > tetrahedral elements of a grid w

Re: speed up a numpy code with huge array

2010-05-25 Thread Stefan Behnel
Alexzive, 25.05.2010 21:05: is there a way to improve the performance of the attached code ? it takes about 5 h on a dual-core (using only one core) when len(V) ~1MIL. V is an array which is supposed to store all the volumes of tetrahedral elements of a grid whose coord. are stored in NN (accesse