Re: best way to get data into a new instance?

2006-09-29 Thread Maxim Sloyko
tobiah wrote: [snip] > class Employee: > > __init__(self, id): > self.id = id > > e = Employee(32445) > > ... later > > > e.firstname = 'foo' > e.lastname = 'bar' > > ... more as the information comes about. Personally, I think that this is not a good solution. How would the re

Re: QuoteSQL

2006-09-29 Thread Duncan Booth
Lawrence D'Oliveiro <[EMAIL PROTECTED]> wrote: > In message <[EMAIL PROTECTED]>, LI wrote: > > execfile("QuoteSQL.py") > EscapeSQLWild(r"\%") >> '%' > SQLString("%" + EscapeSQLWild(r"\%") + "%") >> '"%%%"' > EscapeSQLWild(r"\%") == r"\\%" >> True > SQLString("%" +

Re: Can string formatting be used to convert an integer to its binary form ?

2006-09-29 Thread Steve Holden
MonkeeSage wrote: > Steve Holden wrote: > >> >>> to_bin(0) >>'' > > > Doh! Oh, yeah...that! ;) > > OK... > > def to_bin(x): > out=[] > while x > 0: > out.insert(0, str(x % 2)) > x /= 2 > else: > out.append(str(x)) > return ''.join(out) > It's an often-missed and almost in

Re: wxPython and threading issue

2006-09-29 Thread [EMAIL PROTECTED]
Patrick Smith wrote: > Hi, > Thanks for your reply. > > <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > [Re: cancelling a worker thread from the GUI thread] > > > > Have the main thread set a flag telling the worker thread to exit, and > > have the worker thread check that periodi

Re: License / Registration key enabled software

2006-09-29 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Mike Playle wrote: > License keys exist to make it easier for honest users to > remain honest. It was Ed Felten who said that "keeping honest people honest is like keeping tall people tall". -- http://mail.python.org/mailman/listinfo/python-list

Re: eval(source, {'builtins': {}}) archived as Faq

2006-09-29 Thread Erik Max Francis
Duncan Booth wrote: > I'm slightly surprised that nobody has yet pointed out that the OP failed > at the very first hurdle here. If you are going to do this dangerous trick > then 'builtins' should be spelled '__builtins__': I did, because otherwise the exploit I gave wouldn't have worked so ea

Re: How to find number of characters in a unicode string?

2006-09-29 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Marc 'BlackJack' Rintsch wrote: > In <[EMAIL PROTECTED]>, > Preben Randhol wrote: > >> Is there a way to calculate in characters >> and not in bytes to represent the characters. > > Decode the byte string and use `len()` on the unicode string. Hmmm, for some reas

Re: vector and particle effects

2006-09-29 Thread Richard Jones
Jay wrote: > Sorry for the double post. Google groups was being stubborn. > Jay wrote: >> I'd like to experiment a little bit with vector graphics in python. >> When I say 'vector graphics' I don't mean regular old svg-style. I >> mean vector game style as in simulation of vector beam drawn graph

Re: for: else: - any practical uses for the else clause?

2006-09-29 Thread metaperl
Actually right after posting this I came up with a great usage. I use meld3 for my Python based dynamic HTML generation. Whenever I plan to loop over a tree section I use a for loop, but if there is no data to iterate over, then I simply remove that section from the tree or populate it with a "no d

Re: eval(source, {'builtins': {}}) archived as Faq

2006-09-29 Thread Duncan Booth
Erik Max Francis <[EMAIL PROTECTED]> wrote: > This is an _extremely_ bad idea. _Never_ use eval in a case where you > are trying to validate input. > > >>> def e(source): return eval(source, {'builtins': {}}) > ... > >>> e('__import__("sys").exit()') > > Oops, the interpreter exited. I'm slig

Re: running commands with sudo & python

2006-09-29 Thread db
Hi there, I think you can do that with pexpect http://pexpect.sourceforge.net/ good luck On Thu, 28 Sep 2006 14:18:14 -0700, coldsoul4e wrote: > Hi! > I must execute a command with os.command(), but with root permissions. > Is there anyway to do that with python? > Thanks -- http://mail.p

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-09-29 Thread Robin Becker
Larry Hastings wrote: __ > THE PATCH > > The core concept: adding two strings together no longer returns a pure > "string" object. Instead, it returns a "string concatenation" object > which holds references to the two strings but does not actually > concatenate > them... yet. The strings ar

Re: How to find number of characters in a unicode string?

2006-09-29 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Lawrence D'Oliveiro wrote: > In message <[EMAIL PROTECTED]>, Marc 'BlackJack' > Rintsch wrote: > >> In <[EMAIL PROTECTED]>, >> Preben Randhol wrote: >> >>> Is there a way to calculate in characters >>> and not in bytes to represent the characters. >> >> Decode the byte s

Re: analyzing removable media

2006-09-29 Thread Nick Vatamaniuc
glenn wrote: > Hi > can anyone tell me how given a directory or file path, I can > pythonically tell if that item is on 'removable media', or sometype of > vfs, the label of the media (or volume) and perhaps any other details > about the media itself? > thanks > Glenn It won't be trivial because

Re: Questions on Using Python to Teach Data Structures and Algorithms

2006-09-29 Thread Bruno Desthuilliers
Dennis Lee Bieber wrote: > On 28 Sep 2006 21:17:38 -0700, "MonkeeSage" <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > (Coming in from the cold) >> I guess you were talking about implementing the _structure_ of lisp >> lists in python syntax (as you seem to imply), not

Re: How to find number of characters in a unicode string?

2006-09-29 Thread Gabriel Genellina
At Friday 29/9/2006 04:52, Lawrence D'Oliveiro wrote: > >> Is there a way to calculate in characters > >> and not in bytes to represent the characters. > > > > Decode the byte string and use `len()` on the unicode string. > >Hmmm, for some reason > > len(u"C\u0327") > >returns 2. That's corre

Re: How to find number of characters in a unicode string?

2006-09-29 Thread Leif K-Brooks
Lawrence D'Oliveiro wrote: > Hmmm, for some reason > > len(u"C\u0327") > > returns 2. Is len(unicodedata.normalize('NFC', u"C\u0327")) what you want? -- http://mail.python.org/mailman/listinfo/python-list

Re: wxPython and threading issue

2006-09-29 Thread Nick Vatamaniuc
If your thread is long running and it is not possible to easily set a flag for it to check and bail out, then how does it display the progress in the progress dialog. How often does that get updated? If the progress dialog is updated often, then at each update have the thread check a self.please_di

Re: Can recursive descent parser handle Python grammar?

2006-09-29 Thread Ben Sizer
[EMAIL PROTECTED] wrote: > I'm a compiler newbie and was curious if Python's language/grammar > can be handled by a recursive descent parser. I believe a recursive descent parser can handle any grammar; it just depends on how pure you want it to be. -- Ben Sizer -- http://mail.python.org/mailm

Re: License / Registration key enabled software

2006-09-29 Thread Hendrik van Rooyen
"Steve Holden" <[EMAIL PROTECTED]> Wrote: > Sybren Stuvel wrote: > > Mike Playle enlightened us with: > > > >>Imagine you're an IT manager for a medium-to-large company who wants > >>to use some expensive piece of software. You talk to the vendor and > >>buy a licence to use the software on up to

Re: a different question: can you earn a living with *just* python?

2006-09-29 Thread Magnus Lycka
John Salerno wrote: > It's a nice thought that a person can earn a living programming with > Python, which is fun enough to use just for its own sake. But for > someone like me (i.e. no programming experience) it's always a little > disheartening to see that most (if not all) job descriptions th

Re: Can string formatting be used to convert an integer to its binary form ?

2006-09-29 Thread Frederic Rentsch
[EMAIL PROTECTED] wrote: > Frederic Rentsch: > >> Good idea, but shorter with -> >> >>> SE.SE ('se_definition_files/int_to_binary.se') ('%X' % 987654321) >> '0011101011000110100010110001' >> > > Note that your version keeps the leading zeros. > Have you tested the relative speeds too?

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-09-29 Thread Rob Williscroft
Larry Hastings wrote in news:1159495643.213830.289620 @m7g2000cwm.googlegroups.com in comp.lang.python: > _ > THE PATCH > > The core concept: adding two strings together no longer returns a pure > "string" object. Instead, it returns a "string concatenation" object > which holds referenc

Re: vector and particle effects

2006-09-29 Thread Nick Vatamaniuc
Panda3D is pretty good http://www.panda3d.org/ . It is very well documented and it comes with many examples. There is also pygame. Jay wrote: > I'd like to experiment a little bit with vector graphics in python. > When I say 'vector graphics' I don't mean regular old svg-style. I > mean vecto

BoaConstructor

2006-09-29 Thread Matthew Warren
..I'm just about to start a project, I have a threaded python app currently around 3000 lines / 12-15 source files that is cli driven, and I am about to start using boaConstructor to build a GUI around it.   Has anyone here any advice on wether boaConstructor is actually a good tool for this

Re: Recursive descent algorithm able to parse Python?

2006-09-29 Thread Diez B. Roggisch
Lawrence D'Oliveiro wrote: > In message <[EMAIL PROTECTED]>, Diez B. Roggisch wrote: > >> [EMAIL PROTECTED] schrieb: >>> I'm a compiler newbie and curious if Python grammar is able to >>> be parsed by a recursive descent parser or if it requires >>> a more powerful algorithm. >> >> I might be mi

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-09-29 Thread Felipe Almeida Lessa
28 Sep 2006 19:07:23 -0700, Larry Hastings <[EMAIL PROTECTED]>: > THE BENCHMARKS > > Benchmark 1: > def add(a, b, c, ... t): return a + b + c + ... + t > for i in range(1000): add("aaa", "bbb", "ccc", ..., "ttt") [snip] What about "a + b"? Or "a + b + c"? Does it have a large o

Re: Can string formatting be used to convert an integer to its binary form ?

2006-09-29 Thread Simon Brunning
On 9/29/06, Steve Holden <[EMAIL PROTECTED]> wrote: > Unfortunately forty years of programming experience has taught me that > there's an essentially infinite supply of mistakes to make ... your > mistakes just get smarter most of the time. +1 QOTW. -- Cheers, Simon B, [EMAIL PROTECTED] -- http

Re: Problems with Python 2.5 installer.

2006-09-29 Thread paw
John Machin wrote: > paw wrote: > > I have ran the MSI installer for Python 2.5 several times attempting to > > install to C: > > Python, however all of the files are placed in C:\ . The installer is > > told to only install files for me, beyond that I have only chosen the > > defaults. > > What

File I/O

2006-09-29 Thread Kirt
Hi! I need some help in file I/O I have an xml file.. xyz I want to open these file in append mode and add the line abd Such that i have: xyz xyz can anyone show me the way to achieve this?? thanx -- http://mail.python.org/mailman/listinfo/python-list

Re: windev vs python SOS

2006-09-29 Thread aaaWindev
Hi Bruno, Let me guess, your favorite book is the "I HATE THE FRENCH OFFICIAL HANDBOOK". People here deserve a more objective opinion. Here you can find what WinDev users have to say about WinDev http://www.windev.com/pcsoft/testimonials/ There are more testimonials here (in french). http://ww

Re: windev vs python SOS

2006-09-29 Thread MC
Thank you, Jean-Marc, for translation. I am not capable of this work. :-) -- @-salutations Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: windev vs python SOS

2006-09-29 Thread MC
Thanks. The essential, is that peoples (& you) can understand. Bbut, perso, I don't understand the message translated (much unknowed words...) -- @-salutations Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Organising unit tests

2006-09-29 Thread jimburton
I have a number of unit tests organised hierarchically, all of which inherit fixtures from a base class. To run these all at once I started out using from basic import map, directionalpan, layerorder, layervisibility, listlayers, streamlayerlist # ... lots more ... suite0 = unittest.TestLoader().

Re: File I/O

2006-09-29 Thread jimburton
Kirt wrote: > Hi! I need some help in file I/O > > I have an xml file.. [snip] See http://diveintopython.org/xml_processing/ -- http://mail.python.org/mailman/listinfo/python-list

Re: File I/O

2006-09-29 Thread Kirt
jimburton wrote: > Kirt wrote: > > Hi! I need some help in file I/O > > > > I have an xml file.. > [snip] > See http://diveintopython.org/xml_processing/ i dont wanna parse the xml file.. Just open the file as: f=open('test.xml','a') and write a line "abc" before tag http://mail.python.org/ma

Re: File I/O

2006-09-29 Thread Kirt
jimburton wrote: > Kirt wrote: > > Hi! I need some help in file I/O > > > > I have an xml file.. > [snip] > See http://diveintopython.org/xml_processing/ i dont wanna parse the xml file.. Just open the file as: f=open('test.xml','a') and append a line "abc" before tag -- http://mail.python

Pysqlite tables in RAM

2006-09-29 Thread Ranjitha
Hi all, I'm relatively new to python and am facing a problem with database access I want to store my data in a database on the disk. I also want to be able to reload the tables into the RAM whenever I have a lot of disk accesses and commit the changes back to the database. There is an option of s

Re: windev vs python SOS

2006-09-29 Thread aaaWindev
Hi Stéphane, stéphane bard wrote: > hello, my boss ask me to prefer windev to python. > I have to argue First, no matter how good is Python, you should not desagree with your boss. Second, Windew is quite good and fun, you will love it. -- PatBiker -- http://mail.python.org/mailman/listinfo/py

Re: Generating a PDF file on Linux (try using xtopdf)

2006-09-29 Thread vasudevram
George Adams wrote: > Sorry for what is probably a very basic question... > > I have a database of contact info data (names, addresses, phone, etc.) > I want to take that data and generate a printable booklet-form directory > that can be handed out to people. > > So the database may look something

Re: File I/O

2006-09-29 Thread jimburton
Kirt wrote: > i dont wanna parse the xml file.. > > Just open the file as: > > f=open('test.xml','a') > > and append a line "abc" before tag Use a regex to split the contents and insert new stuff, eg import re prog = prog = re.compile('^(.*)()', re.DOTALL) m = prog.search(f.read()) then m.gro

Re: File I/O

2006-09-29 Thread Diez B. Roggisch
Kirt wrote: > > jimburton wrote: >> Kirt wrote: >> > Hi! I need some help in file I/O >> > >> > I have an xml file.. >> [snip] >> See http://diveintopython.org/xml_processing/ > > i dont wanna parse the xml file.. If you play soccer, do you insist on playing with a baseball bat? The game is ca

RE: Problems with Python 2.5 installer.

2006-09-29 Thread Matthew Warren
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of paw Sent: 29 September 2006 11:01 To: python-list@python.org Subject: Re: Problems with Python 2.5 installer. John Machin wrote: > paw wrote: > > I have ran the MSI installer for Python 2.5 several times at

[ANN] IronPython Community Edition 1.0r2

2006-09-29 Thread Sanghyeon Seo
This is the second release of IronPython Community Edition (IPCE), 1.0 revision 2, based on IronPython 1.0. Get it here: http://sparcs.kaist.ac.kr/~tinuviel/download/IPCE-1.0r2.zip Binary is built with Mono 1.1.17.1. BIG WARNING: it won't work with Mono versions below 1.1.17. Please don't mail m

Re: Pysqlite tables in RAM

2006-09-29 Thread Bruno Desthuilliers
Ranjitha wrote: > Hi all, > > I'm relatively new to python And to databases ? > and am facing a problem with database > access > > I want to store my data in a database on the disk. I also want to be > able to reload the tables into the RAM whenever I have a lot of disk > accesses and commit t

Re: Socks server and client code in Python (Twisted?)

2006-09-29 Thread MaR
The answer may depend somewhat on whether your app is doing mostly storage (filessystem) or calculations (cpu). If you need to handle a fair number of sockets but do little processing, you may wish to look at the standard modules asyncore/asynchat. But Twisted is not a bad advice :o) Maybe a litt

Hai Friends

2006-09-29 Thread NRI Events
Hello Everybody, Happy Navaratri & Happy Dasara I found excellent yellow pages about Indian Temples in USA. http://www.nrievents.com/indiantemples.htm And also info about latest NRI News and NRI Events and NRI services. Regards, -- http://mail.python.org/mailman/listinfo/python-list

Re: Making sure script only runs once instance at a time.

2006-09-29 Thread MaR
A very brutal but simple and effective method is to bind() to a socket on localhost eg (127.0.0.1, 4711), listen() but never accept(). Any other process trying to to bind() on the same port will fail.. When the process dies, the port is released automatically, pending som timedelay.. But this assu

Re: [IronPython] [ANN] IronPython Community Edition 1.0r2

2006-09-29 Thread Sylvain Hellegouarch
Brilliant Seo. Thanks a lot :) BTW, if it can be useful and you're happy with the code, don't hesitate to include my port of the Gzip module. Its a BSD license :) - Sylvain > This is the second release of IronPython Community Edition (IPCE), > 1.0 revision 2, based on IronPython 1.0. > > Get it

Re: Python and Win95B

2006-09-29 Thread Ciar�n � Duibh
Thanks. Python 2.4.3 is fine. Ciarán. - Original Message - From: "Martin v. Löwis" <[EMAIL PROTECTED]> Newsgroups: comp.lang.python To: "Ciarán Ó Duibhín" <[EMAIL PROTECTED]> Sent: Thursday, September 28, 2006 7:28 PM Subject: Re: Python and Win95B > Ciarán Ó Duibhín schrieb: > >

Execute external code and get return value

2006-09-29 Thread Michele Petrazzo
Hi, I want to execute an external code, that become from a text file (pe), call a function inside it and get its return value: # ext_code.txt def funct2Call(): return True # test.py sourcecode = open("ex_code.txt").read() comp_code = compile(sourcecode, "My_test", "exec") #do something like

Re: windev vs python SOS

2006-09-29 Thread Bruno Desthuilliers
[EMAIL PROTECTED] wrote: > Hi Bruno, Heck. PC-Soft marketing droids are pursuing us even here now. > Let me guess, your favorite book is the "I HATE THE FRENCH OFFICIAL > HANDBOOK". je suis français, pauvre semoule. > People here deserve a more objective opinion. "objective" ? Lol. > Here yo

"ValueError: Empty module name" on basic import

2006-09-29 Thread alain MONTMORY
Hello everybody, I am a newbie to python so I hope I am at the right place to expose my problem. :-[ I am working on linux mandrake 10.1 with python : python -V Python 2.3.4 I am trying o run the example which stay in the documentation in paragraph http://www.python.org/doc/2.4.2/ext/pure-

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-09-29 Thread Carl Friedrich Bolz
Robin Becker wrote: > Larry Hastings wrote: > __ >> THE PATCH >> >> The core concept: adding two strings together no longer returns a pure >> "string" object. Instead, it returns a "string concatenation" object >> which holds references to the two strings but does not actually >> concatenate >

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-09-29 Thread Carl Friedrich Bolz
Robin Becker wrote: > Larry Hastings wrote: > __ >> THE PATCH >> >> The core concept: adding two strings together no longer returns a pure >> "string" object. Instead, it returns a "string concatenation" object >> which holds references to the two strings but does not actually >> concatenate >

Re: a different question: can you earn a living with *just* python?

2006-09-29 Thread Antoon Pardon
On 2006-09-28, Roy Smith <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > "Carl J. Van Arsdall" <[EMAIL PROTECTED]> wrote: > >> > Things like decorators and metaclasses certainly add power, but they add >> > complexity too. It's no longer a simple language. >> > >> Well, I think

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-09-29 Thread cfbolz
Robin Becker wrote: > Larry Hastings wrote: > __ >> THE PATCH >> >> The core concept: adding two strings together no longer returns a pure >> "string" object. Instead, it returns a "string concatenation" object >> which holds references to the two strings but does not actually >> concatenate >

Re: windev vs python SOS

2006-09-29 Thread Kent Johnson
[EMAIL PROTECTED] wrote: > Hi Stéphane, > > stéphane bard wrote: >> hello, my boss ask me to prefer windev to python. >> I have to argue > > First, no matter how good is Python, you should not desagree with your > boss. > Second, Windew is quite good and fun, you will love it. Yes, the boss is a

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-09-29 Thread Carl Friedrich Bolz
Robin Becker wrote: > Larry Hastings wrote: > __ >> THE PATCH >> >> The core concept: adding two strings together no longer returns a pure >> "string" object. Instead, it returns a "string concatenation" object >> which holds references to the two strings but does not actually >> concatenate >

Re: windev vs python SOS

2006-09-29 Thread Bruno Desthuilliers
[EMAIL PROTECTED] wrote: > Hi Stéphane, > > stéphane bard wrote: >> hello, my boss ask me to prefer windev to python. >> I have to argue You don't. You're one of the marketing droids from PC-Soft To everyone here : such interventions are a well-known part of PC-Soft (the company that sells the

Re: Organising unit tests

2006-09-29 Thread jimburton
OK, so I'm trying to collect the tests with python and add them to the test suite dynamically, but I have a problem with module names. Here's what I've got: # import os from os.path import join import unittest alltests = unittest.TestSuite() def mightBeATest(f): #TODO

Re: Execute external code and get return value

2006-09-29 Thread Peter Otten
Michele Petrazzo wrote: > I want to execute an external code, that become from a text file (pe), > call a function inside it and get its return value: namespace = {} execfile("ext_code.txt", namespace) print namespace["funct2Call"]() Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Execute external code and get return value

2006-09-29 Thread Michele Petrazzo
Michele Petrazzo wrote: Auto reply: > I find this: http://tinyurl.com/nwbpk > Following this link, here is my solution: code = """ def funct2Call(): return "It work!" object.method(funct2Call) """ class Object(object): def method(self, value): self._callable = value def

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-09-29 Thread Carl Friedrich Bolz
Carl Friedrich Bolz wrote: > Robin Becker wrote: >> Larry Hastings wrote: >> __ >>> THE PATCH >>> >>> The core concept: adding two strings together no longer returns a pure >>> "string" object. Instead, it returns a "string concatenation" object >>> which holds references to the two strings bu

Re: File I/O

2006-09-29 Thread jimburton
Diez B. Roggisch wrote: > Kirt wrote: > > > > > jimburton wrote: > >> Kirt wrote: > >> > Hi! I need some help in file I/O > >> > > >> > I have an xml file.. > >> [snip] > >> See http://diveintopython.org/xml_processing/ > > > > i dont wanna parse the xml file.. > > If you play soccer, do you insis

Re: Execute external code and get return value

2006-09-29 Thread Michele Petrazzo
Peter Otten wrote: > Michele Petrazzo wrote: > >> I want to execute an external code, that become from a text file >> (pe), call a function inside it and get its return value: > > namespace = {} execfile("ext_code.txt", namespace) print > namespace["funct2Call"]() > Sorry, I forgot to say that

Re: A critique of cgi.escape

2006-09-29 Thread Magnus Lycka
Jon Ribbens wrote: > In article <[EMAIL PROTECTED]>, Fredrik Lundh wrote: >> maybe you haven't done software long enough to understand that >> software works better if you use it the way it was intended to be >> used, but that's no excuse for being stupid. > > So what's your excuse? If you don't

Re: Making sure script only runs once instance at a time.

2006-09-29 Thread Hari Sekhon
Seeing as there doesn't seem to be a good answer to this (or at least not one that we have so far some up with) I have decided to fall back to my old friend the unix shell. It's as portable as python, but is very flexible and fast at doing real things and will tell me if another process by this

Re: XSLT speed comparisons

2006-09-29 Thread uche . ogbuji
Damian wrote: > Hi, I'm from an ASP.NET background an am considering making the switch > to Python. I decided to develop my next project in tandem to test the > waters and everything is working well, loving the language, etc. > > What I've got is: > two websites, one in ASP.NET v2 and one in Python

Re: Execute external code and get return value

2006-09-29 Thread Peter Otten
Michele Petrazzo wrote: > Following this link, here is my solution: > > > code = """ > def funct2Call(): > return "It work!" > > object.method(funct2Call) > """ > > class Object(object): > def method(self, value): > self._callable = value > def __call__(self): > r

Re: windev vs python SOS

2006-09-29 Thread M�ta-MCI
Re-Bonjour ! J'avais écrit, dans le message précédent, que la société PC-Soft avait eu des difficultés financières, il y a plusieurs années. Comme je n'ai pas eu l'occasion de vérifier cette information, (et à la demande de la société PC-Soft), je demande donc aux lecteurs de consid

RE: windev vs python SOS

2006-09-29 Thread Tim Golden
[Méta-MCI - translated for non-Francophones] | Re-Bonjour ! Hello again! | J'avais écrit, dans le message précédent, que la société | PC-Soft avait eu des difficultés financières, | il y a plusieurs années. I wrote in the last message that PC-Soft had had financial difficulties a few years ag

Re: Making sure script only runs once instance at a time.

2006-09-29 Thread Paul Rubin
Hari Sekhon <[EMAIL PROTECTED]> writes: > Seeing as there doesn't seem to be a good answer to this (or at least > not one that we have so far some up with) I have decided to fall back > to my old friend the unix shell. It's as portable as python, but is > very flexible and fast at doing real things

Re: XSLT speed comparisons

2006-09-29 Thread uche . ogbuji
Ross Ridge wrote: > Damian wrote: > It could just be that 4suite is slower than MSXML. If so, you can use > MSXML in Python if you want. You'll need to install the Python for > Windows extensions. Something like this: > > from os import environ > import win32com.client > > def

There's another Timbot on the loose!

2006-09-29 Thread Paul Rubin
http://web.cecs.pdx.edu/~mpj/timbot/index.html -- http://mail.python.org/mailman/listinfo/python-list

Re: There's another Timbot on the loose!

2006-09-29 Thread Jorge Godoy
Paul Rubin writes: > http://web.cecs.pdx.edu/~mpj/timbot/index.html Should we tell them that we have the original and have a patent on him? :-) -- Jorge Godoy <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: Pysqlite tables in RAM

2006-09-29 Thread Steve Holden
Ranjitha wrote: > Hi all, > > I'm relatively new to python and am facing a problem with database > access > > I want to store my data in a database on the disk. I also want to be > able to reload the tables into the RAM whenever I have a lot of disk > accesses and commit the changes back to the d

Re: preemptive OOP?

2006-09-29 Thread John Salerno
Steve Holden wrote: > You're right, it *is* just a name change in the code, but if you *do* > later want to specialise the notebook behaviour you can replace the > assignment with a class definition without changing any of your other code. Oh! I wasn't quite thinking along those lines, but now

Re: License / Registration key enabled software

2006-09-29 Thread Paul Boddie
Mike Playle wrote: > Worry instead about the people who DON'T want to use it illegitimately. Can a > license key > scheme help them? That's "help them" as in "we can help you to stay in our good books and avoid us dragging you through the courts, you bad people", I presume? Hardly a vendor-custom

Re: Making sure script only runs once instance at a time.

2006-09-29 Thread Hari Sekhon
I'm not sure if that is a very old way of doing it, which is why I was reluctant to do it. My way actually uses the process list of the os (linux) and counts the number of instances. If it is more than 0 then another process is running and the script exits gracefully. Also, apart from the fact

Re: sqlite3 error

2006-09-29 Thread John Salerno
John Machin wrote: > The problems are (1) there are cultures that don't have the concept of > a surname, and if they do, it may not be the "last name" (2) the name > may consist of only one word (giving you problems with "not null") or > not even be a word. > > It gets better: > > Iceland: Jon B

Re: Pysqlite tables in RAM

2006-09-29 Thread John Salerno
Ranjitha wrote: > Hi all, > > I'm relatively new to python and am facing a problem with database > access > > I want to store my data in a database on the disk. I also want to be > able to reload the tables into the RAM whenever I have a lot of disk > accesses and commit the changes back to the d

Re: There's another Timbot on the loose!

2006-09-29 Thread John Machin
Jorge Godoy wrote: > Paul Rubin writes: > > > http://web.cecs.pdx.edu/~mpj/timbot/index.html > > Should we tell them that we have the original and have a patent on him? :-) > > -- Page last updated in 2002 ... site looks like the Marie Celeste. Perhaps our timbot undert

RE: Making sure script only runs once instance at a time.

2006-09-29 Thread Matthew Warren
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Hari SekhonSent: 29 September 2006 14:55To: python-list@python.orgSubject: Re: Making sure script only runs once instance at a time. I'm not sure if that is a very old way of doing it, which is why I wa

Re: File I/O

2006-09-29 Thread Diez B. Roggisch
jimburton wrote: > > Diez B. Roggisch wrote: >> Kirt wrote: >> >> > >> > jimburton wrote: >> >> Kirt wrote: >> >> > Hi! I need some help in file I/O >> >> > >> >> > I have an xml file.. >> >> [snip] >> >> See http://diveintopython.org/xml_processing/ >> > >> > i dont wanna parse the xml file.. >>

Re: Can string formatting be used to convert an integer to its binary form ?

2006-09-29 Thread Neil Cerutti
On 2006-09-29, Steve Holden <[EMAIL PROTECTED]> wrote: > MonkeeSage wrote: >> So far as unobfuscated versions go, how about the simple: >> >> def to_bin(x): >> out = [] >> while x > 0: >> out.insert(0, str(x % 2)) >> x = x / 2 >> return ''.join(out) >> >> Regards, It was surprising

Problems wth os.stat().st_mtime on Mac

2006-09-29 Thread Michael Glassford
The Python 2.5 News at http://www.python.org/download/releases/2.5/NEWS.txt states that Python 2.5 was changed to "Use Win32 API to implement os.stat/fstat. As a result, subsecond timestamps are reported, the limit on path name lengths is removed, and stat reports WindowsError now (instead of O

Re: wxPython and threading issue

2006-09-29 Thread Patrick Smith
> Well, the problem is that you can't simply kill a thread--it shares > memory with other threads that it could be leaving in an inconsistent > state. Imagine that it was, say, holding a lock when it was forceably > killed. Now any other thread that tries to acquire that lock will > block forever

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-09-29 Thread Larry Hastings
Steve Holden wrote: > you should diff your source against the current > SVN repository and lodge that diff as a patch on SourceForge. Okay, I'll try to do that today. > Your suggested bug isn't, I think a real bug in the current > implementation because as I understand it Python strings do alwa

Re: Pysqlite tables in RAM

2006-09-29 Thread Fredrik Lundh
Ranjitha wrote: > I want to store my data in a database on the disk. I also want to be > able to reload the tables into the RAM whenever I have a lot of disk > accesses and commit the changes back to the database. using the cache_size and synchronous pragmas sounds like a better way to trade rel

Re: wxPython and threading issue

2006-09-29 Thread Patrick Smith
"Nick Vatamaniuc" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > If your thread is long running and it is not possible to easily set a > flag for it to check and bail out, then how does it display the > progress in the progress dialog. How often does that get updated? If > the progr

How to iterate through a sequence, grabbing subsequences?

2006-09-29 Thread Matthew Wilson
I wrote a function that I suspect may already exist as a python builtin, but I can't find it: def chunkify(s, chunksize): "Yield sequence s in chunks of size chunksize." for i in range(0, len(s), chunksize): yield s[i:i+chunksize] I wrote this because I need to take a string of a

Re: Can string formatting be used to convert an integer to its binary form ?

2006-09-29 Thread Georg Brandl
Neil Cerutti wrote: > On 2006-09-29, Steve Holden <[EMAIL PROTECTED]> wrote: >> MonkeeSage wrote: >>> So far as unobfuscated versions go, how about the simple: >>> >>> def to_bin(x): >>> out = [] >>> while x > 0: >>> out.insert(0, str(x % 2)) >>> x = x / 2 >>> return ''.join(out) >>>

Re: Questions on Using Python to Teach Data Structures and Algorithms

2006-09-29 Thread sturlamolden
MonkeeSage wrote: > > def cons(car,cdr): return (car,cdr) # or [car,cdr] > > def car(cons): return cons[0] > > def cdr(cons): return cons[1] > > I guess you were talking about implementing the _structure_ of lisp > lists in python syntax (as you seem to imply), not trying to emulate > their _behav

Re: XSLT speed comparisons

2006-09-29 Thread uche . ogbuji
[EMAIL PROTECTED] wrote: > For what it's worth I just developed, and switched to WSGI middleware > that only does the transform on the server side if the client doesn't > understand XSLT. It's called applyxslt and is part of wsgi.xml [1]. > That reduces server load, and with caching (via Myghty),

Re: Making sure script only runs once instance at a time.

2006-09-29 Thread Fredrik Lundh
Hari Sekhon wrote: > I'm not sure if that is a very old way of doing it, which is why I was > reluctant to do it. My way actually uses the process list of the os > (linux) and counts the number of instances. If it is more than 0 then > another process is running and the script exits gracefully.

Re: Can string formatting be used to convert an integer to its binary form ?

2006-09-29 Thread Neil Cerutti
On 2006-09-29, Georg Brandl <[EMAIL PROTECTED]> wrote: > Neil Cerutti wrote: >> On 2006-09-29, Steve Holden <[EMAIL PROTECTED]> wrote: >>> MonkeeSage wrote: So far as unobfuscated versions go, how about the simple: def to_bin(x): out = [] while x > 0: out.inse

Re: "ValueError: Empty module name" on basic import

2006-09-29 Thread John Machin
alain MONTMORY wrote: > Hello everybody, > > I am a newbie to python so I hope I am at the right place to expose my > problem. :-[ > > I am working on linux mandrake 10.1 with python : > python -V > Python 2.3.4 > I am trying o run the example which stay in the documentation in paragraph > http

[ANN] Spasmoidal 0.1.0 - Asynchronous I/O with Python 2.5 Extended Generators

2006-09-29 Thread [EMAIL PROTECTED]
"...from little towns with strange names like Smegma, Spasmodic, Frog, and the far-flung Isles of Langerhans". Someone on SourceForge has a project that includes the name 'spasmodic' so I'm using the name spasmoidal. But this code will always be spasmodic to me. Asynchronous I/O (and other tasks)

Re: How to iterate through a sequence, grabbing subsequences?

2006-09-29 Thread Bruno Desthuilliers
Matthew Wilson wrote: > I wrote a function that I suspect may already exist as a python builtin, > but I can't find it: > > def chunkify(s, chunksize): > "Yield sequence s in chunks of size chunksize." > for i in range(0, len(s), chunksize): > yield s[i:i+chunksize] > > I wrote th

  1   2   3   >