Re: Memory problem with threading

2008-01-15 Thread Clement
On Jan 16, 5:24 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi! > > I made a string parser program, it has a main function and a working > thread class. When it is running in 24h non-stop, the memory run out. > I dont Know why. Do anybody know somekind of debugger that can i see > what is

Re: no pass-values calling?

2008-01-15 Thread Hrvoje Niksic
"J. Peng" <[EMAIL PROTECTED]> writes: > we create a new list and assign it to x for future use. How to > destroy the before list [1,2,3]? does python destroy it > automatically? Yes, Python detects that the older list is no longer in use (if that is indeed the case), and destroys it automaticall

Re: import from question

2008-01-15 Thread Tobiah
Duncan Booth wrote: > iu2 <[EMAIL PROTECTED]> wrote: > >> file a3.py: >> >> from a1 import the_number >> import a2 >> > ... >> Why doesn't it work in the first version of a3.py? >> > Think of 'import a2' as being the same as: > > a2 = __import__('a2') > > and 'from a1 import the_number'

Re: module naming conventions

2008-01-15 Thread Tobiah
> Release your package as free software on the Cheeseshop > http://cheeseshop.python.org/>. If the name you want is already > taken, pick one that will help users distinguish yours from the > existing one. > I like this idea. I developed a library with a name that got a couple of obscure softwa

itertools.groupby

2008-01-15 Thread Tobiah
In the docs and examples that I have seen so far, it is suggested that the groupby() input list may be pre-sorted with the same function that is passed to groupby as a key extractor. I tried doing this with a simple example, but noticed that [].sort(func) passes two arguments to func, whereas the

Re: Interesting Thread Gotcha

2008-01-15 Thread Hendrik van Rooyen
"Dan" wrote: > >>> keyboard_thread = thread.start_new_thread(kbd_driver (port_q,kbd_q)) > > Needs to be > >>> keyboard_thread = thread.start_new_thread(kbd_driver, (port_q,kbd_q)) > > Commas are important! > > -Dan Absolutely! - well spotted! As the first correct respondent, you win the fre

Re: no pass-values calling?

2008-01-15 Thread J. Peng
On Jan 16, 2008 3:03 PM, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Wed, 16 Jan 2008 13:59:03 +0800, "J. Peng" <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > > > How to modify the array passed to the function? I tried something like this: > > > > >>> a > > [1, 2, 3] >

Re: no pass-values calling?

2008-01-15 Thread Christian Heimes
Ben Finney wrote: > The term "reference" is fine, since that's exactly how it works. One > gets at an object via some reference, be it a name or some access into > a container object. When an object has no more references to itself, > it becomes a candidate for garbage collection. And so on. Thank

Re: no pass-values calling?

2008-01-15 Thread J. Peng
On Jan 16, 2008 2:30 PM, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Wed, 16 Jan 2008 13:59:03 +0800, J. Peng wrote: > > > Hi, > > > > How to modify the array passed to the function? I tried something like > > this: > > > a > > [1, 2, 3] > def mytest(x): > > ... x=[4,5,6] > > > This

Re: no pass-values calling?

2008-01-15 Thread Ben Finney
Christian Heimes <[EMAIL PROTECTED]> writes: > Dennis Lee Bieber wrote: > > Since all "variable" names in Python are references to objects, > > anything accessed using a name is accessed by reference. > > Anybody using the terms variable, reference or call-by-value is most > likely explaining

Re: no pass-values calling?

2008-01-15 Thread Chris
On Jan 16, 7:59 am, "J. Peng" <[EMAIL PROTECTED]> wrote: > On Jan 16, 2008 1:45 PM, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > > > On Wed, 16 Jan 2008 11:09:09 +0800, "J. Peng" <[EMAIL PROTECTED]> > > > alist = [] > > anint = 2 > > astr = "Touch me" > > > dummy(alist, anint, astr) > > >

Re: no pass-values calling?

2008-01-15 Thread Steven D'Aprano
On Wed, 16 Jan 2008 13:59:03 +0800, J. Peng wrote: > Hi, > > How to modify the array passed to the function? I tried something like > this: > a > [1, 2, 3] def mytest(x): > ... x=[4,5,6] This line does NOT modify the list [1, 2, 3]. What it does is create a new list, and assign it

Re: can't find pyAntTasks.properties

2008-01-15 Thread superwesman
On Jan 15, 11:41 pm, superwesman <[EMAIL PROTECTED]> wrote: > Hi - I'm trying to use pyAntTasks. I downloaded the jar and placed it > into ~/.ant/lib, put that directory into my CLASSPATH. I then created > a very simple build.xml and I'm getting a failure I can't explain. > > Here is my build.xml

Re: Image to browser

2008-01-15 Thread danielatdaveschool
On Jan 16, 12:38 am, Justin Ezequiel <[EMAIL PROTECTED]> wrote: > On Jan 16, 1:19 pm, [EMAIL PROTECTED] wrote: > > > > > On Jan 16, 12:16 am, [EMAIL PROTECTED] wrote: > > > > Im using mod_python and apache2 using psp for output of page, i open a > > > file and resize it with the following code > >

Re: no pass-values calling?

2008-01-15 Thread J. Peng
On Jan 16, 2008 1:45 PM, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Wed, 16 Jan 2008 11:09:09 +0800, "J. Peng" <[EMAIL PROTECTED]> > > alist = [] > anint = 2 > astr = "Touch me" > > dummy(alist, anint, astr) > > "dummy" can only modify the contents of the first argument -- the > inte

Re: no pass-values calling?

2008-01-15 Thread Christian Heimes
Dennis Lee Bieber wrote: > Since all "variable" names in Python are references to objects, > anything accessed using a name is accessed by reference. Anybody using the terms variable, reference or call-by-value is most likely explaining Python the wrong way. Sorry dude :) Christian -- ht

can't find pyAntTasks.properties

2008-01-15 Thread superwesman
Hi - I'm trying to use pyAntTasks. I downloaded the jar and placed it into ~/.ant/lib, put that directory into my CLASSPATH. I then created a very simple build.xml and I'm getting a failure I can't explain. Here is my build.xml: Here is my CLASSPATH: > echo $CLASSPATH /home/wtorres/.ant/

Re: Image to browser

2008-01-15 Thread Justin Ezequiel
On Jan 16, 1:19 pm, [EMAIL PROTECTED] wrote: > On Jan 16, 12:16 am, [EMAIL PROTECTED] wrote: > > > Im using mod_python and apache2 using psp for output of page, i open a > > file and resize it with the following code > > > <% > > import Image, util > > > fields = util.FieldStorage(req) > > filename

Re: Image to browser

2008-01-15 Thread danielatdaveschool
On Jan 16, 12:16 am, [EMAIL PROTECTED] wrote: > Hi, noob here > > Im using mod_python and apache2 using psp for output of page, i open a > file and resize it with the following code > > <% > import Image, util > > fields = util.FieldStorage(req) > filename = fields.getlist('src')[0] > > path = '/va

Image to browser

2008-01-15 Thread danielatdaveschool
Hi, noob here Im using mod_python and apache2 using psp for output of page, i open a file and resize it with the following code <% import Image, util fields = util.FieldStorage(req) filename = fields.getlist('src')[0] path = '/var/www/content/' + filename size = 128, 128 im = Image.open(path)

What have you been up to

2008-01-15 Thread zegizuve10048
We have all the best Pian Meds discoveyamazing.com -- http://mail.python.org/mailman/listinfo/python-list

Re: no pass-values calling?

2008-01-15 Thread Steven D'Aprano
On Wed, 16 Jan 2008 11:09:09 +0800, J. Peng wrote: > Hello, > > I saw this statement in Core Python Programming book, > > All arguments of function calls are made by reference, meaning that any > changes to these parameters within the function affect the original > objects in the calling functio

Re: reliable whois in python

2008-01-15 Thread Nikolas Karalis
I had done a project part of which was what you want to do. You can find it here... http://users.ntua.gr/ge04042/projects/dns/ Feel free to use the code. I hope this helps. Nikolas On Jan 15, 2008 5:48 AM, eliss <[EMAIL PROTECTED]> wrote: > Hi everyone, > > I'm trying to write a python script t

Asynchronous HTTP

2008-01-15 Thread Clement
Can i use asynchttp for http secure connection... If so plz how does it can be done. Is there any other library can do that that -- http://mail.python.org/mailman/listinfo/python-list

Re: Is str/unicode.encode supposed to work? with replace/ignore

2008-01-15 Thread Matt Nordhoff
BerlinBrown wrote: > With this code, ignore/replace still generate an error > > # Encode to simple ascii format. > field.full_content = field.full_content.encode('ascii', > 'replace') > > Error: > > [0/1] 'ascii' codec can't decode byte 0xe2 in positi

no pass-values calling?

2008-01-15 Thread J. Peng
Hello, I saw this statement in Core Python Programming book, All arguments of function calls are made by reference, meaning that any changes to these parameters within the function affect the original objects in the calling function. Does this mean there is not pass-values calling to a function

Re: Restart crashing modules in windows

2008-01-15 Thread Mike Driscoll
On Jan 15, 2008 5:08 PM, Astan Chee <[EMAIL PROTECTED]> wrote: > > Mike Driscoll wrote: > On Jan 14, 9:02 pm, Astan Chee <[EMAIL PROTECTED]> wrote: > > > Hi, > I have a python module that keeps on crashing with various windows > errors (not BSOD but the less lethal windows XP popup ones). Now th

error/warning color customization in interactive console?

2008-01-15 Thread yhvh
Is it possible to output error messages in a different color? I'm using Terminal on Gnome. -- http://mail.python.org/mailman/listinfo/python-list

Re: print >> to a derived file

2008-01-15 Thread Scott David Daniels
iu2 wrote: > Hi, > > I'm trying to write data to both a file and the console, so I did: > > class File_and_console(file): > def write(self, s): > file.write(self, s) > print s, f = File_and_console('1.txt', 'w') ... Always use the same method for writing,

Is str/unicode.encode supposed to work? with replace/ignore

2008-01-15 Thread BerlinBrown
With this code, ignore/replace still generate an error # Encode to simple ascii format. field.full_content = field.full_content.encode('ascii', 'replace') Error: [0/1] 'ascii' codec can't decode byte 0xe2 in position 14317: ordinal not in ran ge(1

login to https (newbie)

2008-01-15 Thread bkamrani
Hi Python gurus! Please help me how I can login to this page: https://www.boplats.se/user/login_hs.aspx?ReturnUrl=/HSS/Default.aspx I tried these two codes, but I don't seem to be successfull at all. (Both gave same result.) Many many thanks, /Ben --- import urllib2,urllib,cookielib url

Re: Python too slow?

2008-01-15 Thread Jaimy Azle
"Paul Boddie" <[EMAIL PROTECTED]> wrote: >> >> perhaps in the future another sillly point could be added also, Java has >> Jython, while Python doesn't have some thing like PyJava or... perhaps >> Py-va >> (Python based Java Language). > > You could compile Java to CPython bytecode or, in the case

Re: __init__ explanation please

2008-01-15 Thread Steven D'Aprano
On Tue, 15 Jan 2008 14:02:43 -0800, Lie wrote: > I've been in this Python mailing list for a few days, and I've noticed > several things here: There are too many fundamentalist! > > Don't play stupid and all, don't be a fundamentalist. It might be true > that __init__ isn't a constructor and __ne

Re: searching an XML doc

2008-01-15 Thread Gowri
On Jan 15, 3:49 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Gowri schrieb: > > > Hello, > > > I've been reading about ElementTreee and ElementPath so I could use > > them to find the right elements in the DOM. Unfortunately neither of > > these seem to offer XPath like capabilities where I

Memory problem with threading

2008-01-15 Thread [EMAIL PROTECTED]
Hi! I made a string parser program, it has a main function and a working thread class. When it is running in 24h non-stop, the memory run out. I dont Know why. Do anybody know somekind of debugger that can i see what is eating the memory? Maybe there is a list or value or dictionary that is growin

Re: Data mapper - need to map an dictionary of values to a model

2008-01-15 Thread Luke
On Jan 15, 3:53 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > On Jan 14, 7:56 pm, Luke <[EMAIL PROTECTED]> wrote: > > > > > I am writing an order management console. I need to create an import > > system that is easy to extend. For now, I want to accept an dictionary > > of values and map them to

Re: Data mapper - need to map an dictionary of values to a model

2008-01-15 Thread George Sakkis
On Jan 15, 6:53 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > name_tranformer = lambda input: dict( >zip(('first_name', 'last_name'), >input['name'])) Of course that should write: name_tranformer = lambda input: dict(

Re: Data mapper - need to map an dictionary of values to a model

2008-01-15 Thread George Sakkis
On Jan 14, 7:56 pm, Luke <[EMAIL PROTECTED]> wrote: > I am writing an order management console. I need to create an import > system that is easy to extend. For now, I want to accept an dictionary > of values and map them to my data model. The thing is, I need to do > things to certain columns: > >

Re: Restart crashing modules in windows

2008-01-15 Thread Astan Chee
Mike Driscoll wrote: On Jan 14, 9:02 pm, Astan Chee <[EMAIL PROTECTED]> wrote: Hi, I have a python module that keeps on crashing with various windows errors (not BSOD but the less lethal windows XP popup ones). Now these are intentional and rather sporadic so I cant really solve it by attempt

Re: dbus-python for windows

2008-01-15 Thread Suraj Barkale
est gmail.com> writes: > I am trying to port Scribes to Windows, Hi there like minded fellow > sourceforge.net/projects/windbus/≥ but it not for Python, so how could > I install dbus module for Windows Python 2.5 ? I have also started to dabble in windbus-python for the sake of Scribes. I have

RE: __init__ explanation please

2008-01-15 Thread Reedick, Andrew
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of Lie > Sent: Tuesday, January 15, 2008 5:03 PM > To: python-list@python.org > Subject: Re: __init__ explanation please > > I've been in this Python mailing list for a few days, and I've noticed >

Re: "env" parameter to "popen" won't accept Unicode on Windows -minor Unicode bug

2008-01-15 Thread Bjoern Schliessmann
John Nagle wrote: > The problem is that only the NT-derived Microsoft systems > talk Unicode. The DOS/Win16/Win9x family did not. But they did > have CreateProcess. So the current code will handle Win9x, but not > Unicode. Please explain, I don't understand. If you try using Windows system functio

Re: __init__ explanation please

2008-01-15 Thread Lie
I've been in this Python mailing list for a few days, and I've noticed several things here: There are too many fundamentalist! Don't play stupid and all, don't be a fundamentalist. It might be true that __init__ isn't a constructor and __new__ might be the constructor (some people even claimed __n

Re: Why this apparent assymetry in set operations?

2008-01-15 Thread John Machin
On Jan 16, 3:25 am, "Colin J. Williams" <[EMAIL PROTECTED]> wrote: Colin W. > > I'm sorry, there appears to be a bug: There is, but but not where you think it is :-) > # tSet.py > import sets [not the bug] Earlier evidence is that you are using 2.5.1; why import sets?? > s1= sets.Set([1, 2, 3]

Re: searching an XML doc

2008-01-15 Thread Diez B. Roggisch
Gowri schrieb: > Hello, > > I've been reading about ElementTreee and ElementPath so I could use > them to find the right elements in the DOM. Unfortunately neither of > these seem to offer XPath like capabilities where I can find elements > based on tag, attribute values etc. Are there any librari

Re: Magic function

2008-01-15 Thread Ruediger
[EMAIL PROTECTED] wrote: > Hi Rüdiger, > > Thanks for your message. I liked your approach and I've been trying > something along exactly these sorts of lines, but I have a few > problems and queries. > > The first problem is that the id of the frame object can be re-used, > so for example this

Re: Perl Template Toolkit: Now in spicy new Python flavor

2008-01-15 Thread George Sakkis
On Jan 15, 3:15 pm, Joshua Kugler <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > I'd like to inform the Python community that the powerful and popular > > Template Toolkit system, previously available only in its original > > Perl implementation, is now also available in a beta Python >

Re: Running Multiple Versions

2008-01-15 Thread Moises Alberto Lindo Gutarra
that is correct, you can work several version of python in same machine. When you execute some script you only need redirect %PATH% and %PYTHONPATH% 2008/1/15, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > Hi, > > We are windows shop with some unix servers as well. We run 2.4.1 and > want to begin migr

Re: Why this apparent assymetry in set operations?

2008-01-15 Thread Steven D'Aprano
On Tue, 15 Jan 2008 11:25:25 -0500, Colin J. Williams wrote: > I'm sorry, there appears to be a bug: # tSet.py > import sets > s1= sets.Set([1, 2, 3]) > s1.union_update([3, 4,5]) > print(s1) > s2= sets.Set([6, 7, 8]) > s1 |+ s2 # This fails: > exceptions.TypeError: bad operand type for un

Re: "env" parameter to "popen" won't accept Unicode on Windows -minor Unicode bug

2008-01-15 Thread John Nagle
Diez B. Roggisch wrote: > Brian Smith wrote: > >> Diez B. Roggisch wrote: >>> Sure thing, python will just magically convert unicode to the >>> encoding the program YOU invoke will expect. Right after we >>> introduced the >>> >>> solve_my_problem() >>> >>> built-in-function. Any other wishes? >>

Re: Compile with GLib-1.2 instead of 2.4

2008-01-15 Thread Brandon Perry
Sorry, I know what arg to use with ./configure. With --with-libc=STRING, do I put the version I want, or the path to my GLib 1.2 files? On Tue, 2008-01-15 at 14:53 -0600, Brandon Perry wrote: > Hi, I am having to compile a standalone python because the webserver I > use doesn't allow access to /usr

Running Multiple Versions

2008-01-15 Thread noel
Hi, We are windows shop with some unix servers as well. We run 2.4.1 and want to begin migrating to 2.5.1. I am looking for information dealing with having more than one version of python on a server at one time. I believe this is called side-by-side and all that is needed to select a version on

Re: ElementTree and namespaces in the header only

2008-01-15 Thread Torsten Bronger
Hallöchen! Fredrik Lundh writes: > Peter Bengtsson wrote: > >> root = Element('feed', xmlns='http://www.w3.org/2005/Atom') >> root.set('xmlns:se', NS_URL) >> entry = SubElement(root, 'entry') >> SubElement(root, 'title').text = 'Title' >> SubElement(entry, SEN('category')).text = 'Category' > >>

Re: super, decorators and gettattribute

2008-01-15 Thread Richard Szopa
On Jan 15, 8:06 pm, Helmut Jarausch <[EMAIL PROTECTED]> wrote: > Unfortunately the links [2], [3] and [4] are not given, Luckily, there's Google :) [2] Article about MRO: http://www.python.org/download/releases/2.3/mro/ [3] Descriptor HowTo: http://users.rcn.com/python/download/Descriptor.htm [4

Compile with GLib-1.2 instead of 2.4

2008-01-15 Thread Brandon Perry
Hi, I am having to compile a standalone python because the webserver I use doesn't allow access to /usr/lib/python. I tried compiling on my lappy and uploading it, but the webserver does not have GLib-2.4. What arguments would I have to include in order for it to compile with GLib-1.2 instead of/an

UTF-8 in basic CGI mode

2008-01-15 Thread coldpizza
Hi, I have a basic Python CGI web form that shows data from a SQLite3 database. It runs under the built-in CGIWebserver which looks something like this: [code] from BaseHTTPServer import HTTPServer from CGIHTTPServer import CGIHTTPRequestHandler HTTPServer("8000", CGIHTTPRequestHandler).serve_fo

Re: A question about event handlers with wxPython

2008-01-15 Thread Mike Driscoll
On Jan 15, 2:20 pm, "Erik Lind" <[EMAIL PROTECTED]> wrote: > That all looks cool. I will experiment more. I'm a bit slow on this as only > two weeks old so far. > > Thanks for the patience No problem. I'm pretty slow with some toolkits too...such as SQLAlchemy. Ugh. Mike -- http://mail.python.or

searching an XML doc

2008-01-15 Thread Gowri
Hello, I've been reading about ElementTreee and ElementPath so I could use them to find the right elements in the DOM. Unfortunately neither of these seem to offer XPath like capabilities where I can find elements based on tag, attribute values etc. Are there any libraries which can give me XPath

Re: A question about event handlers with wxPython

2008-01-15 Thread Erik Lind
That all looks cool. I will experiment more. I'm a bit slow on this as only two weeks old so far. Thanks for the patience -- http://mail.python.org/mailman/listinfo/python-list

Re: "env" parameter to "popen" won't accept Unicode on Windows - minor Unicode bug

2008-01-15 Thread John Nagle
Diez B. Roggisch wrote: > John Nagle wrote: > >> Benjamin wrote: >>> On Jan 14, 6:26 pm, Bjoern Schliessmann >> [EMAIL PROTECTED]> wrote: John Nagle wrote: > It turns out that the strings in the "env" parameter have to be > ASCII, not Unicode, even though Windows fully supports Unicod

Re: Perl Template Toolkit: Now in spicy new Python flavor

2008-01-15 Thread Joshua Kugler
[EMAIL PROTECTED] wrote: > I'd like to inform the Python community that the powerful and popular > Template Toolkit system, previously available only in its original > Perl implementation, is now also available in a beta Python > implementation: > > http://tt2.org/python/index.html > > I created

Re: MySQL-python-1.2.2 install with no mysql

2008-01-15 Thread washakie
Thank you... after: %yum install mysql* I was able to build and install mysql-python -- View this message in context: http://www.nabble.com/MySQL-python-1.2.2-install-with-no-mysql-tp14836669p14845579.html Sent from the Python - python-list mailing list archive at Nabble.com. -- http://ma

UTF-8 in basic CGI mode

2008-01-15 Thread coldpizza
Hi, I have a basic Python CGI web form that shows data from a SQLite3 database. It runs under the built-in CGIWebserver which looks like this: [code] import SimpleHTTPServer import SocketServer SocketServer.TCPServer(("", 80),SimpleHTTPServer.SimpleHTTPRequestHandler).serve_forever() [/code] The

Re: Perl Template Toolkit: Now in spicy new Python flavor

2008-01-15 Thread SJ Carter
Congrats. This will no doubt prove valuable to any Python programmer. -- http://mail.python.org/mailman/listinfo/python-list

Re: Data mapper - need to map an dictionary of values to a model

2008-01-15 Thread bearophileHUGS
Luke: > I'm not familiar with this pattern. I will search around, but if you > have any links or you would like to elaborate, that would be > wonderful. :) It's not a pattern, it's a little thing: def line_filter(filein, params): for line in filein: if good(line, params): yield extrac

RE: "env" parameter to "popen" won't accept Unicode on Windows -minor Unicode bug

2008-01-15 Thread Bjoern Schliessmann
Brian Smith wrote: > popen() knows that it is running on Windows, and it knows what > encoding Windows needs for its environment (it's either UCS2 or > UTF-16 for most Windows APIs). At least when it receives a unicode > string, it has enough information to apply the conversion > automatically, and

Re: Benchmark [was Re: common problem - elegant solution sought]

2008-01-15 Thread [EMAIL PROTECTED]
On Jan 15, 6:18 pm, Paul Rubin wrote: > Helmut Jarausch <[EMAIL PROTECTED]> writes: > > def del_by_key(L,key) : > >for pos, (k,d) in enumerate(L): > > if k == key : > >del L[pos] > >break > > This looks very dangerous, mutating L while iterating

Re: Data mapper - need to map an dictionary of values to a model

2008-01-15 Thread Luke
On Jan 15, 1:53 am, [EMAIL PROTECTED] wrote: > Luke: > > >What design patterns would you use here?< > > What about "generator (scanner) with parameters"? :-) > > Bye, > bearophile I'm not familiar with this pattern. I will search around, but if you have any links or you would like to elaborate, th

Re: super, decorators and gettattribute

2008-01-15 Thread Helmut Jarausch
Michele Simionato wrote: > I really need to publish this one day or another, since these > questions > about super keeps coming out: > > http://www.phyast.pitt.edu/~micheles/python/super.html Unfortunately the links [2], [3] and [4] are not given, Helmut. -- Helmut Jarausch Lehrstuhl fuer N

Re: Benchmark [was Re: common problem - elegant solution sought]

2008-01-15 Thread Helmut Jarausch
Paul Rubin wrote: > Helmut Jarausch <[EMAIL PROTECTED]> writes: >> def del_by_key(L,key) : >>for pos, (k,d) in enumerate(L): >> if k == key : >>del L[pos] >>break > > This looks very dangerous, mutating L while iterating over it. No, as Bruno Desthuilliers has pointed ou

Re: Python in IIS + WSGI

2008-01-15 Thread Phillip Sitbon
Looks like Sourceforge had a problem with the file upload, causing it to be empty - I just fixed it. http://pyisapie.sourceforge.net/ > On Jan 11, 4:37 pm, Phillip Sitbon <[EMAIL PROTECTED]> wrote: > > > Recently (finally) updated the PyISAPIe project. Version 1.0.4 > > includes WSGI support (tes

Re: SyntaxError: 'import *' not allowed with 'from .'

2008-01-15 Thread Steven Bethard
George Sakkis wrote: > Unless I missed it, PEP 328 doesn't mention anything about this. > What's the reason for not allowing "from .relative.module import *' ? Generally, there's a move away from all "import *" versions these days. For example, Python 3.0 removes the ability to use "import *" wit

Re: Open existing Word document, modify and save.

2008-01-15 Thread Mike Driscoll
On Jan 15, 12:01 pm, gsal <[EMAIL PROTECTED]> wrote: > New to Python and new to Win32. Help please. > > O.k., so this might seem like one of those "can you do my homework" > kind of postings, except that is not homework, it is officework. > > I have been reading the Core Python book and I am really

Iterate through slots

2008-01-15 Thread Jared Grubb
How can I iterate through the slots of a class, including those it inherits from parent classes? class C(object): __slots__ = ['a'] class D(C): __slots__ = ['b'] >>> d = D() >>> d.__slots__ ['b'] >>> d.a = 1 # this works, so slots inherit properly >>> d.b = 2 >>> d.c = 3 # this doesnt work,

Re: Why this apparent assymetry in set operations?

2008-01-15 Thread Neil Cerutti
On Jan 15, 2008 12:06 PM, Chris M <[EMAIL PROTECTED]> wrote: > On Jan 15, 11:51 am, "Neil Cerutti" <[EMAIL PROTECTED]> wrote: > > > > So this is a bug in set_update or in set_ior. They can't both be > > right. > > > > It's not a bug. > > "Note, the non-operator versions of union(), intersection(),

Re: Why this apparent assymetry in set operations?

2008-01-15 Thread Paul Rubin
Chris M <[EMAIL PROTECTED]> writes: > precludes error-prone constructions like set('abc') & 'cbs' in favor > of the more readable set('abc').intersection('cbs')." set('abc') & set('cbs') -- http://mail.python.org/mailman/listinfo/python-list

Re: short path evaluation, why is f() called here: dict(a=1).get('a', f())

2008-01-15 Thread Paul Rubin
aspineux <[EMAIL PROTECTED]> writes: > Nice idea, but if I want args I need to write it like that: > > x=d.get('a', defaultfunc=f, funcargs=(1,2,3)) Yeah, that looks good. The default arg to f should be the key being looked up. -- http://mail.python.org/mailman/listinfo/python-list

Re: Benchmark [was Re: common problem - elegant solution sought]

2008-01-15 Thread Paul Rubin
Helmut Jarausch <[EMAIL PROTECTED]> writes: > def del_by_key(L,key) : >for pos, (k,d) in enumerate(L): > if k == key : >del L[pos] >break This looks very dangerous, mutating L while iterating over it. -- http://mail.python.org/mailman/listinfo/python-list

Re: Dynamical scoping

2008-01-15 Thread Paul Rubin
Kay Schluehr <[EMAIL PROTECTED]> writes: > On 15 Jan., 02:13, Paul Rubin wrote: > > George Sakkis <[EMAIL PROTECTED]> writes: > > > What's the best way to simulate dynamically scoped variables ala Lisp ? > > > > Ugh check the docs for the python 2.5 "with" statement,

Open existing Word document, modify and save.

2008-01-15 Thread gsal
New to Python and new to Win32. Help please. O.k., so this might seem like one of those "can you do my homework" kind of postings, except that is not homework, it is officework. I have been reading the Core Python book and I am really excited about starting my next project with Python, instead of

Re: Python's great, in a word

2008-01-15 Thread Jan Claeys
Op Mon, 07 Jan 2008 05:09:15 -0800, schreef MartinRinehart: > Would you Python old-timers try to agree on a word or two that > completes: > > The best thing about Python is ___. > > Please, no laundry lists, just a word or two. I'm thinking "fluid" or > "grace" but I'm not sure I've done eno

Re: super, decorators and gettattribute

2008-01-15 Thread Rhamphoryncus
On Jan 13, 5:51 am, Richard Szopa <[EMAIL PROTECTED]> wrote: > On Jan 13, 8:59 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > > > On Sat, 12 Jan 2008 14:23:52 -0800, Richard Szopa wrote: > > > However, I am very surprised to learn that > > > > super_object.__getattr__(name)(*args, **kwar

Re: ElementTree and namespaces in the header only

2008-01-15 Thread Fredrik Lundh
Peter Bengtsson wrote: > root = Element('feed', xmlns='http://www.w3.org/2005/Atom') > root.set('xmlns:se', NS_URL) > entry = SubElement(root, 'entry') > SubElement(root, 'title').text = 'Title' > SubElement(entry, SEN('category')).text = 'Category' > But surely the xmlns:se attribute on the tag

Re: Why this apparent assymetry in set operations?

2008-01-15 Thread Chris M
On Jan 15, 11:51 am, "Neil Cerutti" <[EMAIL PROTECTED]> wrote: > > So this is a bug in set_update or in set_ior. They can't both be > right. > It's not a bug. "Note, the non-operator versions of union(), intersection(), difference(), and symmetric_difference(), issubset(), and issuperset() method

Re: Why this apparent assymetry in set operations?

2008-01-15 Thread Neil Cerutti
On Jan 15, 2008 11:07 AM, Skip Montanaro <[EMAIL PROTECTED]> wrote: > > > Why is that? Doesn't the |= operator essentially map to an update() call? > > > > No, according to 3.7 Set Types, s | t maps to s.union(t). > > I was asking about the |= assignment operator which according to the > docs *doe

Re: A question about event handlers with wxPython

2008-01-15 Thread Mike Driscoll
On Jan 15, 9:04 am, "Erik Lind" <[EMAIL PROTECTED]> wrote: > > def HandleSomething(self, event): > >generating_control = event.GetEventObject() > >print generating_control > > > HTH, > > Thank you.That is what I was looking for, but as often seems the case, one > thing exposes another. Is t

Re: Benchmark [was Re: common problem - elegant solution sought]

2008-01-15 Thread bearophileHUGS
Helmut Jarausch: > The clear winner is > > def del_by_key(L,key) : >for pos, (k,d) in enumerate(L): > if k == key : >del L[pos] >break If you use Psyco this is faster: def del_by_key(L,key): pos = 0 for pair in L: if pair[0] == key : del L[pos]

Re: Python too slow?

2008-01-15 Thread bearophileHUGS
[EMAIL PROTECTED]: > A lecturer gave me the perfect answer to the question of speed. > "You have two choices when it comes to programming. Fast code, or fast > coders." I don't believe that anymore, ShedSkin compiles slowly and it has limitations still, but it shows that it's possible to create a

Leo 4.4.6 beta 2 released

2008-01-15 Thread Edward K Ream
Leo 4.4.6 beta 2 is available at: http://sourceforge.net/project/showfiles.php?group_id=3458&package_id=29106 Leo 4.4.6 fixes several recently reported bugs, all minor. Leo is a text editor, data organizer, project manager and much more. See: http://webpages.charter.net/edreamleo/intro.html The

Retrieving info from DBUS at application startup

2008-01-15 Thread Frank Aune
Hello, Detecting Hotpluggable hardware using DBUS works great, but usually peripherals are already connected when launching the application. How can I (preferably using DBUS) detect which USB printers for example are connected to the system at application launch without engaging in some insane

Re: Why this apparent assymetry in set operations?

2008-01-15 Thread Colin J. Williams
Colin J. Williams wrote: > Neil Cerutti wrote: >> On Jan 15, 2008 10:10 AM, <[EMAIL PROTECTED]> wrote: >>> I've noticed that I can update() a set with a list but I can't extend a set >>> with a list using the |= assignment operator. >>> >>> >>> s = set() >>> >>> s.update([1,2,3]) >>> >

Re: jpype with JFreeChart, anyone interested to help?

2008-01-15 Thread Peter Wang
On Jan 14, 8:25 pm, oyster <[EMAIL PROTECTED]> wrote: > Thanx > However I knew Chaco and matplotlib, and I use matplotlib during my > school days. And as I have pointed out, they are for "plot", but not > "chart". If you don't know the difference between plot and chart, you > can have a look at ath

Re: Why this apparent assymetry in set operations?

2008-01-15 Thread Sergio Correia
Both of you are correct. >>> x = set([1,2,3]) >>> y = set([4,5]) >>> x |= y >>> x set([1, 2, 3, 4, 5]) On Jan 15, 2008 11:07 AM, Skip Montanaro <[EMAIL PROTECTED]> wrote: > > > Why is that? Doesn't the |= operator essentially map to an update() call? > > > > No, according to 3.7 Set Types, s |

Re: Why this apparent assymetry in set operations?

2008-01-15 Thread Skip Montanaro
> > Why is that? Doesn't the |= operator essentially map to an update() call? > > No, according to 3.7 Set Types, s | t maps to s.union(t). I was asking about the |= assignment operator which according to the docs *does* map to the update method. Skip -- http://mail.python.org/mailman/list

Re: Why this apparent assymetry in set operations?

2008-01-15 Thread Skip Montanaro
> If the RHS is a set then it works OK: Yup, I understand that. Would be kind of bad if it didn't. ;-) > It could be modifies to handle any > iterable on the RHS. That's my question. Why does it work in one place but not everywhere? Skip -- http://mail.python.org/mailman/listinfo/python-

Re: Interesting Thread Gotcha

2008-01-15 Thread Dan
On Jan 15, 10:07 am, "Hendrik van Rooyen" <[EMAIL PROTECTED]> wrote: > I thought I would share this nasty little gotcha with the group. > > Consider the following code fragment: > > > print 'starting kbd thread' > keyboard_thread = thread.start_new_thread(kbd_driver (port_q,kbd_q)) > print 'starti

Re: Why this apparent assymetry in set operations?

2008-01-15 Thread Colin J. Williams
Neil Cerutti wrote: > On Jan 15, 2008 10:10 AM, <[EMAIL PROTECTED]> wrote: >> I've noticed that I can update() a set with a list but I can't extend a set >> with a list using the |= assignment operator. >> >> >>> s = set() >> >>> s.update([1,2,3]) >> >>> s >> set([1, 2, 3]) >>

Re: Why this apparent assymetry in set operations?

2008-01-15 Thread Neil Cerutti
On Jan 15, 2008 10:10 AM, <[EMAIL PROTECTED]> wrote: > > I've noticed that I can update() a set with a list but I can't extend a set > with a list using the |= assignment operator. > > >>> s = set() > >>> s.update([1,2,3]) > >>> s > set([1, 2, 3]) > >>> s |= [4,5,6] > Trace

Re: A question about event handlers with wxPython

2008-01-15 Thread Mike Driscoll
On Jan 15, 9:04 am, "Erik Lind" <[EMAIL PROTECTED]> wrote: > > def HandleSomething(self, event): > >generating_control = event.GetEventObject() > >print generating_control > > > HTH, > > Thank you.That is what I was looking for, but as often seems the case, one > thing exposes another. Is t

Why this apparent assymetry in set operations?

2008-01-15 Thread skip
I've noticed that I can update() a set with a list but I can't extend a set with a list using the |= assignment operator. >>> s = set() >>> s.update([1,2,3]) >>> s set([1, 2, 3]) >>> s |= [4,5,6] Traceback (most recent call last): File "", line 1, in TypeError:

  1   2   >