Re: Incrementally converting a C app to Python

2006-05-10 Thread G. Monzón
Hi Bjorn, I think the best approach is highly-dependent to your current C application design and way of doing things. For a type of application you would take the opposite path than for other I thought. Yes I did that one time, but I re-coded all from scratch... and since that I usually do in

Re: A critic of Guido's blog on Python's lambda

2006-05-10 Thread Petr Prikryl
Alex Martelli wrote... Joe Marshall wrote: ... If you language allows unnamed integers, unnamed strings, unnamed characters, unnamed arrays or aggregates, unnamed floats, unnamed expressions, unnamed statements, unnamed argument lists, etc. why *require* a name for trivial

Re: A critic of Guido's blog on Python's lambda

2006-05-10 Thread M Jared Finder
Alex Martelli wrote: Stefan Nobis [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] (Alex Martelli) writes: if anonymous functions are available, they're used in even more cases where naming would help Yes, you're right. But don't stop here. What about expressions? Many people write very complex

Re: Dictionaries -- ahh the fun.. (newbie help)

2006-05-10 Thread Gerard Flanagan
rh0dium wrote: Hi all, Can someone help me out. I am trying to determing for each run whether or not the test should pass or fail but I can't seem to access the results .. Alternatively can someone suggest a better structure ( and a lesson as to the reasoning ) that would be great too!!

Re: A critic of Guido's blog on Python's lambda

2006-05-10 Thread Antoon Pardon
Op 2006-05-09, Pisin Bootvong schreef [EMAIL PROTECTED]: Antoon Pardon wrote: Op 2006-05-09, Pisin Bootvong schreef [EMAIL PROTECTED]: Antoon Pardon wrote: Op 2006-05-09, Pisin Bootvong schreef [EMAIL PROTECTED]: Is this a Slippery Slope fallacious argument?

Re: Reading Soap struct type

2006-05-10 Thread Simon Brunning
On 5/10/06, Diez B. Roggisch [EMAIL PROTECTED] wrote: That is because it is no hash - AFAIK SOAP doesn't support hashes (or dicts, in python-lingo) out of the box. What you see above essentially a named tuple. Conceptionally like this: class MyStruct: def __init__(self, foo, bar):

Re: Memory leak in Python

2006-05-10 Thread Sybren Stuvel
[EMAIL PROTECTED] enlightened us with: My program is a simulation program with four classes and it mimics bittorrent file sharing systems on 2000 nodes. Wouldn't it be better to use an existing simulator? That way, you won't have to do the stuff you don't want to think about, and focus on the

Re: New tail recursion decorator

2006-05-10 Thread Diez B. Roggisch
Kay Schluehr wrote: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496691 Neat. Diez -- http://mail.python.org/mailman/listinfo/python-list

Error : 10053, 'Software caused connection abort'

2006-05-10 Thread - C Saha -
Hi All I have a mail function in my pythin code and seems like due to that I am getting this error when ever I am running the pythin code. Any idea, how to resolve this? Error is = (10053, 'Software caused connection abort') My code is

Re: Can Python installation be as clean as PHP?

2006-05-10 Thread XBello
It's possible to work with php just with these single file? Maybe I'm doing the wrong thing, because to start to program I needed to install a web server too (a large bunch of files). Also I've been looking into http://www.modpython.org/, which appears to be a modular kind of python with less than

Re: Multi-line lambda proposal.

2006-05-10 Thread Sybren Stuvel
Kaz Kylheku enlightened us with: In the case of if/elif/else, they have to be placed behind the closest suite that follows the expression in the syntax of the statement: if lambda(x)(4) 0: print a lambda: return x + 1 elif y = 4: print b else: print foo

MySQLdb trouble

2006-05-10 Thread Nicolay A. Vasiliev
Hello there! I got some trouble trying to insert data into the database with MySQLdb module. I have such code: from MySQLdb import * def loc_connect_db(): The DB connection subroutine db = MySQLdb.connect(host = localhost, user = root,

Re: installing numpy

2006-05-10 Thread Gary Wessle
Robert Kern [EMAIL PROTECTED] writes: Raymond L. Buvel wrote: Since you are a new Linux user, you should definitely follow Robert's advice about building as an ordinary user separately from the install. I sometimes take a shortcut and just do the install as user root. However, I then

Re: Multi-line lambda proposal.

2006-05-10 Thread Sybren Stuvel
[EMAIL PROTECTED] enlightened us with: multi-line lambdas, had it been added to python a long time ago, would had reduced a lot of complexity in the language. for example - with multi-line lambdas - decorators are unneccesary. I love decorators. just give the multi-line lambda as an

Re: Redirecting unittest output to a Text widget

2006-05-10 Thread Peter Otten
MrBlueSky wrote: Morning! I'm writing my first Python program, so please have patience! I'd like to redirect the output from my application's unit tests (import unittest) to a Tkinter Text object. I found the magic to redirect stdout and stderr: sys.stdout = myTextWindow

Re: Multi-line lambda proposal.

2006-05-10 Thread [EMAIL PROTECTED]
multi-line lambdas, had it been added to python a long time ago, would had reduced a lot of complexity in the language. for example - with multi-line lambdas - decorators are unneccesary. just give the multi-line lambda as an argument to a function - no need for special syntax.. the alternative

Re: Redirecting unittest output to a Text widget

2006-05-10 Thread MrBlueSky
Excellent, that seems to have done the trick! FWIW: I should admit that I haven't really taken the time to properly understand unittest... I'm too eager to get my tests written :-) So for reasons I do not as yet understand Peter's suggestion above didn't quite work for me but the following

Re: ascii to latin1

2006-05-10 Thread Serge Orlov
Luis P. Mendes wrote: Errors occur when I assign the result of ''.join(cp for cp in de_str if not unicodedata.category(cp).startswith('M')) to a variable. The same happens with de_str. When I print the strings everything is ok. Here's a short example of data: 115448,DAÇÃO 117788,DA 1º DE

Re: Memory leak in Python

2006-05-10 Thread Serge Orlov
[EMAIL PROTECTED] wrote: I am using Ubuntu Linux. My program is a simulation program with four classes and it mimics bit torrent file sharing systems on 2000 nodes. Now, each node has lot of attributes and my program kinds of tries to keep tab of everything. As I mentioned its a simulation

Re: Multi-line lambda proposal.

2006-05-10 Thread Antoon Pardon
Op 2006-05-10, [EMAIL PROTECTED] schreef [EMAIL PROTECTED]: multi-line lambdas, had it been added to python a long time ago, would had reduced a lot of complexity in the language. for example - with multi-line lambdas - decorators are unneccesary. I don't like the words neccesary or

Re: A critic of Guido's blog on Python's lambda

2006-05-10 Thread Ketil Malde
[EMAIL PROTECTED] (Alex Martelli) writes: But if we can agree to name every function except continuations I'll be content FWIW, I disagree: A simple example, doubling each entry in a list: map (*2) xs vs. let double x = x*2 in map double xs Here's another example, extracting all

Re: A critic of Guido's blog on Python's lambda

2006-05-10 Thread Rob Warnock
Ketil Malde [EMAIL PROTECTED] wrote: +--- | Sometimes the best documentation is the code itself. | Sometimes the best name for a function is the code itself. +--- And there's no reason that an anonymous LAMBDA [even if compiled] couldn't store its source code in the name

Re: New tail recursion decorator

2006-05-10 Thread Kay Schluehr
Diez B. Roggisch wrote: Kay Schluehr wrote: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496691 Neat. Diez Hi Diez, for all those who already copied and pasted the original solution and played with it I apologize for radical changes in the latest version ( the recipe is on

Re: simultaneous assignment

2006-05-10 Thread Boris Borcic
Steve R. Hastings wrote: You could also use a function that counts all different values in a list, reducing the list to a dictionary whose keys are the unique values from the list. I got the idea from a discussion here on comp.lang.python; I called my version of it tally(). d =

Re: Can Python installation be as clean as PHP?

2006-05-10 Thread Ravi Teja
No! mod_python needs Python. It is simply an integration module for Apache and Python, not an interpreter. -- http://mail.python.org/mailman/listinfo/python-list

Re: data entry tool

2006-05-10 Thread Peter
Diez B. Roggisch wrote: Make it a webapp. That will guarantee to make it runnable on the list of OSses you gave. Use Django/TurboGears/ZOPE for the application itself- whichever suits you best. A webapp isn't feasible as most of the users are on dial up (this is in New Zealand and broadband

Re: advanced number recognition in strings?

2006-05-10 Thread [EMAIL PROTECTED]
Thank you all for your suggestions. After a few modifications the approach with the regexps works well! Sebastian -- http://mail.python.org/mailman/listinfo/python-list

Re: A critic of Guido's blog on Python's lambda

2006-05-10 Thread sross
I do wonder what would happen to Cells if I ever want to support multiple threads. Or in a parallel processing environment. AFAIK It should be fine. In LW, SBCL and ACL all bindings of dynamic variables are thread-local. Cheers, Sean. -- http://mail.python.org/mailman/listinfo/python-list

Re: A critic of Guido's blog on Python's lambda

2006-05-10 Thread Boris Borcic
Ken Tilton wrote: Now if you are like most people, you think that means X. It does not. As far as natural language and understanding are concerned, to mean means conformity to what most people understand, Humpty Dumpties notwithstanding. Cheers. --

Re: Python's regular expression?

2006-05-10 Thread Edward Elliott
bruno at modulix wrote: From a readability/maintenance POV, Perl is a perfect nightmare. It's certainly true that perl lacks the the eminently readable quality of python. But then so do C, C++, Java, and a lot of other languages. And I'll grant you that perl is more susceptible to the

Re: A critic of Guido's blog on Python's lambda

2006-05-10 Thread Boris Borcic
Bill Atkins wrote: It's interesting how much people who don't have macros like to put them down and treat them as some arcane art that are too *insane*ly powerful to be used well. They're actually very straightforward and can often (shock of shocks!) make your code more readable, without

Re: Incrementally converting a C app to Python

2006-05-10 Thread Nick Craig-Wood
BJörn Lindqvist [EMAIL PROTECTED] wrote: Hello. At work I'm the sole maintainer and developer of a medium sized ~50k line C application. The lion share of this app was written before my time so it is pretty hard to read and also contain lots of bugs. I'm contemplating converting the

Re: Is PythonCard dead?

2006-05-10 Thread andy47
Luis M. González wrote: 18 months? Wow!.. time flies... Anyway, PythonCard is a fine product, and it's very good just the way it is. It would be great if a new release comes up though... The mailing list is quite active : http://news.gmane.org/gmane.comp.python.pythoncard And there is work

Re: A critic of Guido's blog on Python's lambda

2006-05-10 Thread Petr Prikryl
Chris Uppal wrote... Alex Martelli wrote: I think it's reasonable to make a name a part of functions, classes and modules because they may often be involved in tracebacks (in case of uncaught errors): to me, it makes sense to let an error-diagnosing tracebacks display packages, modules,

Re: multiline strings and proper indentation/alignment

2006-05-10 Thread bruno at modulix
John Salerno wrote: Gary Herron wrote: Gary John Salerno wrote: How do you make a single string span multiple lines, but also allow yourself to indent the second (third, etc.) lines so that it lines up where you want it, without causing the newlines and tabs or spaces to be added to the

Redirecting unittest output to a Text widget

2006-05-10 Thread MrBlueSky
Morning! I'm writing my first Python program, so please have patience! I'd like to redirect the output from my application's unit tests (import unittest) to a Tkinter Text object. I found the magic to redirect stdout and stderr: sys.stdout = myTextWindow sys.stderr = myTextWindow where

Re: A critic of Guido's blog on Python's lambda

2006-05-10 Thread Chris Uppal
Petr Prikryl wrote: for element in aCollection: if element 0: return True return False [I'm not sure whether this is supposed to be an example of some specific language (Python ?) or just a generic illustration. I'll take it as the latter, since

Re: A critic of Guido's blog on Python's lambda

2006-05-10 Thread Michele Simionato
Ken Tilton wrote: I was not thinking about the thread issue (of which I know little). The big deal for Cells is the dynamic bit: (let ((*dependent* me)) (funcall (rule me) me)) Then if a rule forces another cell to recalculate itself, *dependent* gets rebound and (the fun

Re: A critic of Guido's blog on Python's lambda

2006-05-10 Thread Chris Uppal
Bill Atkins wrote: My favorite macro is ITERATE [...] Thanks for the examples. -- chris -- http://mail.python.org/mailman/listinfo/python-list

Use subprocesses in simple way...

2006-05-10 Thread Dara Durum
Hi ! Py2.4, Win32. I need to optimize a program that have a speciality: hash (MD5/SHA1) the file contents (many files). Now I do this in a simple python program, because (what a pity) the FSUM utility died in a file with unicode filename... (It is unknown error: I used alternate file name, but

Re: installing numpy

2006-05-10 Thread Raymond L. Buvel
Gary Wessle wrote: Robert Kern [EMAIL PROTECTED] writes: Raymond L. Buvel wrote: Since you are a new Linux user, you should definitely follow Robert's advice about building as an ordinary user separately from the install. I sometimes take a shortcut and just do the install as user root.

New tail recursion decorator

2006-05-10 Thread Kay Schluehr
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496691 -- http://mail.python.org/mailman/listinfo/python-list

Proposal: Base variables

2006-05-10 Thread Antoon Pardon
When you want to specify a location or moment, it sometimes is easier to do so in an absolute way and sometimes it is easier to do so relative to some kind of base. Examples of this are the Scheduler objects with the enter and enterabs methods and the seek method of files. However python has no

wx.ListCtrl.EditLabel

2006-05-10 Thread carlosperezs
I have problems with this method. I have programmed this wx.Listctrl: self.ListCtrlMarks = wx.ListCtrl(self.panel, -1, style = wx.LC_REPORT) self.Bind(wx.EVT_LIST_ITEM_SELECTED,self.OnSelectedItemList,self.ListCtrlMarks) vs.Add(self.ListCtrlMarks, 1, wx.EXPAND | wx.ALL, 4)

Re: ascii to latin1

2006-05-10 Thread Luis P. Mendes
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 With regards to º, Richie already gave you food for thoughts, if you want 1 DE MO to match 1º DE MO remove that symbol from the key (linha_key = linha_key.translate({uº: None}), if you don't want such a fuzzy matching, keep it. Thank you all

Re: Use subprocesses in simple way...

2006-05-10 Thread Serge Orlov
Dara Durum wrote: [snip design of a multi-processor algorithm] I thought md5 algorithm is pretty light, so you'll be I/O-bound, then why bother with multi-processor algorithm? 2.) Do you know command line to just like FSUM that can compute file hashes (MD5/SHA1), and don't have any problems

Re: interactive shell -- reload definitions?

2006-05-10 Thread bruno at modulix
Metalone wrote: I have a question about the interactive Python shell. Is it possible to reload a file and get the new definitions. For example, if I do import xyz Then I find a bug in some function in xyz. So, I edit xyz.py I would like to reload the definitions in xyz.py without

Delivery failure notification

2006-05-10 Thread Symantec_Mail_Security_for_SMTP
Your message with Subject: could not be delivered to the following recipients: [EMAIL PROTECTED] Please do not resend your original message. Delivery attempts will continue to be made for 5 day(s). -- http://mail.python.org/mailman/listinfo/python-list

Re: regular expressions, substituting and adding in one step?

2006-05-10 Thread Kent Johnson
John Salerno wrote: Call me crazy, but I'm interested in regular expressions right now. :) Not crazy at all. REs are a powerful and useful tool that every programmer should know how to use. They're just not the right tool for every job! Kent --

Re: Python editor recommendation.

2006-05-10 Thread mystilleef
The powerful no-nonsense, no-frills, no-hassle, no-fuzz editor, Scribes. Supports everything you'd want in an editor, it's nimble, fast and agile, and it has virtually no learning curve. http://scribes.sourceforge.net/ http://scribes.sourceforge.net/snippets.htm (Flash Demo)

Re: Reading Soap struct type

2006-05-10 Thread Diez B. Roggisch
Thomas Thomas schrieb: Hi All, I am receiving a hash below from my Soap Interface SOAPpy.Types.structType item at 34661160: {'Field12value': ':C F3Value', 'Field8': 'Price Text:price_text', 'Field9': 'Text with File:file_text ', 'Field11value': ':CF2Value', 'Field7': 'Product

Re: distutils

2006-05-10 Thread David S.
Dan Crosta dcrosta at sccs.swarthmore.edu writes: I don't understand -- you can install multiple scripts with a single setup.py. Do you want finer-grained control over which are installed by a single invocation of setup.py? In that case, you should re-read the distutils docs about

Re: Error : 10053, 'Software caused connection abort'

2006-05-10 Thread Fredrik Lundh
C Saha wrote: I have a mail function in my pythin code and seems like due to that I am getting this error when ever I am running the pythin code. Any idea, how to resolve this? Error is = (10053, 'Software caused connection abort') if you remove the catch all and don't tell me what really

Re: clear memory? how?

2006-05-10 Thread Grégoire Dooms
Ben C wrote: On 2006-05-09, Ben C [EMAIL PROTECTED] wrote: def clearall(): all = [var for var in globals() if __ not in (var[:2], var[-2:])] for var in all: del globals()[var] since I think magic things always start and end with __. Oops, got that wrong anyway: should

Re: A critic of Guido's blog on Python's lambda

2006-05-10 Thread David C.Ullrich
On Tue, 09 May 2006 05:35:47 -0500, David C. Ullrich [EMAIL PROTECTED] wrote: On Mon, 08 May 2006 18:46:57 -0400, Ken Tilton [EMAIL PROTECTED] wrote: [...] If you, um, look at the code you see that cells.a = 42 triggers cells.__setattr__, which fires a's callback; the callback then reaches

Re: PyExcelerator: How does one close a file?

2006-05-10 Thread tkpmep
John, I had spelled PyExcelerator with a capital P, but it worked just fine. I then checked the directory it was installed in, and found it read C:\Python24\Lib\site-packages\PyExcelerator. As soon as I changed the directory name to C:\Python24\Lib\site-packages\pyExcelerator, my programs stopped

Re: New tail recursion decorator

2006-05-10 Thread Duncan Booth
Kay Schluehr wrote: Diez B. Roggisch wrote: Kay Schluehr wrote: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496691 Neat. Diez Hi Diez, for all those who already copied and pasted the original solution and played with it I apologize for radical changes in the latest

Re: Multi-line lambda proposal.

2006-05-10 Thread nikie
Kaz Kylheku wrote: Kaz Kylheku wrote: But suppose that the expression and the multi-line lambda body are reordered? That is to say, the expression is written normally, and the mlambda expressions in it serve as /markers/ indicating that body material follows. This results in the most

Re: Chicago Python Users Group Thurs May 11 at 7pm

2006-05-10 Thread bray
This will be our best meeting yet! ChiPy's Monthly meeting this Thurs. May 11, 2006. 7pm. (except for folks who want to help setup at 6:30 and get first dibs on pizza) Location ThoughtWorks' Chicago office 651 West Washington Blvd., 6th floor Chicago, IL 60661 Location description: 6

Re: clear memory? how?

2006-05-10 Thread Ben C
On 2006-05-10, Gr�goire Dooms [EMAIL PROTECTED] wrote: Ben C wrote: On 2006-05-09, Ben C [EMAIL PROTECTED] wrote: def clearall(): all = [var for var in globals() if __ not in (var[:2], var[-2:])] for var in all: del globals()[var] since I think magic things always start and

Re: data entry tool

2006-05-10 Thread Serge Orlov
Peter wrote: Diez B. Roggisch wrote: Make it a webapp. That will guarantee to make it runnable on the list of OSses you gave. Use Django/TurboGears/ZOPE for the application itself- whichever suits you best. A webapp isn't feasible as most of the users are on dial up (this is in New

Re: regular expressions, substituting and adding in one step?

2006-05-10 Thread John Salerno
Kent Johnson wrote: They're just not the right tool for every job! Thank god for that! As easy as they've become to me (after seeming utterly cryptic and impenetrable), they are still a little unwieldy. Next step: learn how to write look-ahead and look-behind REs! :) --

Re: clearerr called on NULL FILE* ?

2006-05-10 Thread Chad Austin
Sorry to respond to myself; I wanted to give an update on this crash. It turns out it's a race condition with multiple threads accessing the same Python file object! http://sourceforge.net/tracker/index.php?func=detailaid=595601group_id=5470atid=105470 Python-dev thread at

Re: multiline strings and proper indentation/alignment

2006-05-10 Thread John Salerno
bruno at modulix wrote: Why not trying by yourself ?-) Doh! I always forget I can do this! :) Mmm. Not good. Let's try again: print textwrap.dedent(s).strip() this is a multiline triple-quted string with indentation for nicer code formatting Well, seems like we're done. About 2'30''

Re: problemi con POST

2006-05-10 Thread Heavy
Sorry, you got reason, I thought I can write in my language, cause this is the first time that I post a question in this group... My problem is that I have to receive parameters from a POST method, i try to read them from the socket 'rfile', but this action is blocking, it never finish to read. Is

Re: MySQLdb trouble

2006-05-10 Thread John Salerno
Nicolay A. Vasiliev wrote: def loc_connect_db(): The DB connection subroutine db = MySQLdb.connect(host = localhost, user = root, passwd=mysql, db=some_db) return db Hi. Sorry I can't help, but I'm

Re: Python's regular expression?

2006-05-10 Thread Dave Hansen
On Wed, 10 May 2006 06:44:27 GMT in comp.lang.python, Edward Elliott [EMAIL PROTECTED] wrote: Would I recommend perl for readable, maintainable code? No, not when better options like Python are available. But it can be done with some effort. I'm reminded of a comment made a few years ago by

Re: A critic of Guido's blog on Python's lambda

2006-05-10 Thread Marcin 'Qrczak' Kowalczyk
Followup-To: comp.lang.lisp Bill Atkins [EMAIL PROTECTED] writes: The cool thing about ITERATE is that it lets you express looping concepts in a language designed explicitly for such a purpose, e.g. (iter (for x in '(1 3 3)) (summing x)) = 7 (iter (for x in '(1 -3 2))

reusing parts of a string in RE matches?

2006-05-10 Thread John Salerno
I probably should find an RE group to post to, but my news server at work doesn't seem to have one, so I apologize. But this is in Python anyway :) So my question is, how can find all occurrences of a pattern in a string, including overlapping matches? I figure it has something to do with

Chicago Python Users Group Thurs May 11 at 7pm

2006-05-10 Thread Brian Ray
This will be our best meeting yet! ChiPy's Monthly meeting this Thurs. May 11, 2006. 7pm. (except for folks who want to help setup at 6:30 and get first dibs on pizza) Location ThoughtWorks' Chicago office 651 West Washington Blvd., 6th floor Chicago, IL 60661 Location description: 6

Re: problemi con POST

2006-05-10 Thread bruno at modulix
Heavy wrote: Sorry, you got reason, I thought I can write in my language, cause this is the first time that I post a question in this group... ot usually, the comp.* usenet hierarchy is english-speaking. /ot My problem is that I have to receive parameters from a POST method, i try to read

Re: New tail recursion decorator

2006-05-10 Thread Michele Simionato
Kay Schluehr wrote: for all those who already copied and pasted the original solution and played with it I apologize for radical changes in the latest version ( the recipe is on version 1.5 now ! ). The latest implementation is again a lot faster than the previous one. It does not only get rid

Re: A critic of Guido's blog on Python's lambda

2006-05-10 Thread Chris F Clark
David C Ullrich asked: Q: How do we ensure there are no loops in the dependencies? Do we actually run the whole graph through some algorithm to verify there are no loops? The question you are asking is the dependency graph a directed acyclic graph (commonly called a DAG)? One algorithm to

Re: reusing parts of a string in RE matches?

2006-05-10 Thread Murali
John Salerno wrote: So my question is, how can find all occurrences of a pattern in a string, including overlapping matches? I figure it has something to do with look-ahead and look-behind, but I've only gotten this far: import re string = 'abababababababab' pattern =

PIL thumbnails unreasonably large

2006-05-10 Thread Almad
Hello, I wonder how do I create reasonable thumbnails from JPEG with PIL. My code: logging.debug('Downloading image %s' % id) uri = ''.join([config['photo']['masterpath'], '?p=', str(id)]) uf = urlopen(uri).read() f = tmpfile()

Re: multiline strings and proper indentation/alignment

2006-05-10 Thread Dave Hansen
On Wed, 10 May 2006 13:56:52 GMT in comp.lang.python, John Salerno [EMAIL PROTECTED] wrote: bruno at modulix wrote: Why not trying by yourself ?-) Doh! I always forget I can do this! :) Mmm. Not good. Let's try again: print textwrap.dedent(s).strip() this is a multiline triple-quted

Re: A critic of Guido's blog on Python's lambda

2006-05-10 Thread Ken Tilton
sross wrote: I do wonder what would happen to Cells if I ever want to support multiple threads. Or in a parallel processing environment. AFAIK It should be fine. In LW, SBCL and ACL all bindings of dynamic variables are thread-local. Ah, I was guilty of making an unspoken segue: the

Re: PIL thumbnails unreasonably large

2006-05-10 Thread Almad
Forgot to add: I'm using PIL 1.1.5 with Python 2.4, expected on both Gentoo Linux and Windows XP. -- http://mail.python.org/mailman/listinfo/python-list

Re: A critic of Guido's blog on Python's lambda

2006-05-10 Thread Alex Martelli
M Jared Finder [EMAIL PROTECTED] wrote: ... Your reasoning, taken to the extreme, implies that an assembly language, by virtue of having the fewest constructs, is the best designed language Except that the major premise is faulty! Try e.g.

Re: reusing parts of a string in RE matches?

2006-05-10 Thread Bo Yang
John Salerno 写道: I probably should find an RE group to post to, but my news server at work doesn't seem to have one, so I apologize. But this is in Python anyway :) So my question is, how can find all occurrences of a pattern in a string, including overlapping matches? I figure it has

Re: MySQLdb trouble

2006-05-10 Thread Thomas Bartkus
John Salerno [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Nicolay A. Vasiliev wrote: def loc_connect_db(): The DB connection subroutine db = MySQLdb.connect(host = localhost, user = root, passwd=mysql,

Re: data entry tool

2006-05-10 Thread Kent Johnson
Peter wrote: This post seeks advice on whether python would be appropriate for a task, or whether you can suggest another approach. The project is to transcribe historical records such as schools admissions, ship passenger lists, birth/death/marriages, etc for genealogy studies. What we

Re: A critic of Guido's blog on Python's lambda

2006-05-10 Thread David Hopwood
M Jared Finder wrote: Alex Martelli wrote: Stefan Nobis [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] (Alex Martelli) writes: if anonymous functions are available, they're used in even more cases where naming would help Yes, you're right. But don't stop here. What about expressions? Many

Re: A critic of Guido's blog on Python's lambda

2006-05-10 Thread Ken Tilton
Boris Borcic wrote: Ken Tilton wrote: Now if you are like most people, you think that means X. It does not. As far as natural language and understanding are concerned, to mean means conformity to what most people understand, Humpty Dumpties notwithstanding. Nonsense. You are

Re: PIL thumbnails unreasonably large

2006-05-10 Thread Larry Bates
Almad wrote: Hello, I wonder how do I create reasonable thumbnails from JPEG with PIL. My code: logging.debug('Downloading image %s' % id) uri = ''.join([config['photo']['masterpath'], '?p=', str(id)]) uf = urlopen(uri).read() f =

Re: A critic of Guido's blog on Python's lambda

2006-05-10 Thread Ken Tilton
Boris Borcic wrote: Bill Atkins wrote: It's interesting how much people who don't have macros like to put them down and treat them as some arcane art that are too *insane*ly powerful to be used well. They're actually very straightforward and can often (shock of shocks!) make your code

Re: PIL thumbnails unreasonably large

2006-05-10 Thread Fredrik Lundh
Almad wrote: I wonder how do I create reasonable thumbnails from JPEG with PIL. My code: logging.debug('Downloading image %s' % id) uri = ''.join([config['photo']['masterpath'], '?p=', str(id)]) uf = urlopen(uri).read() f = tmpfile()

Re: Memory leak in Python

2006-05-10 Thread bruno at modulix
[EMAIL PROTECTED] wrote: (top-post corrected) bruno at modulix wrote: [EMAIL PROTECTED] wrote: I have a python code which is running on a huge data set. After starting the program the computer becomes unstable and gets very diffucult to even open konsole to kill that process. What I am

Re: reusing parts of a string in RE matches?

2006-05-10 Thread BartlebyScrivener
Right about now somebody usually jumps in and shows you how to do this without using regex and using string methods instead. I'll watch. rd -- http://mail.python.org/mailman/listinfo/python-list

Re: multiline strings and proper indentation/alignment

2006-05-10 Thread John Salerno
Dave Hansen wrote: print textwrap.dedent(s).strip().replace('\n',' ') this is a multiline triple-quted string with indentation for nicer code formatting But I have some newlines that are already embedded in the string, and I wouldn't want those replaced. --

Re: MySQLdb trouble

2006-05-10 Thread John Salerno
Thomas Bartkus wrote: 1) His code body will be less likely to cause migrane headaches when he tries to read and interpret what he did a year from now. If you are trying to figure out what is going on with the logic, user names and passwords can be so much chaff your brain needs to wade

Re: reusing parts of a string in RE matches?

2006-05-10 Thread John Salerno
Bo Yang wrote: This matches all the 'ab' followed by an 'a', but it doesn't include the 'a'. What I'd like to do is find all the 'aba' matches. A regular findall() gives four results, but really there are seven. I try the code , but I give seven results ! Sorry, I meant that findall()

Re: reusing parts of a string in RE matches?

2006-05-10 Thread John Salerno
BartlebyScrivener wrote: Right about now somebody usually jumps in and shows you how to do this without using regex and using string methods instead. I'll watch. rd Heh heh, I'm sure you're right, but this is more just an exercise for me in REs, so I'm curious how you might do it,

Re: MySQLdb trouble

2006-05-10 Thread Thomas Bartkus
John Salerno [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Thomas Bartkus wrote: 1) His code body will be less likely to cause migrane headaches when he tries to read and interpret what he did a year from now. If you are trying to figure out what is going on with the logic,

Re: A critic of Guido's blog on Python's lambda

2006-05-10 Thread Ken Tilton
[Sorry, I missed this one originally.] David C. Ullrich wrote: On Tue, 09 May 2006 05:35:47 -0500, David C. Ullrich [EMAIL PROTECTED] wrote: On Mon, 08 May 2006 18:46:57 -0400, Ken Tilton [EMAIL PROTECTED] wrote: [...] If you, um, look at the code you see that cells.a = 42 triggers

Decoupling fields from forms in Django

2006-05-10 Thread George Sakkis
Didn't have much luck in the Django list, so I'm posting it here just in case anyone has come up with this problem. Django maintains two parallel hierarchies of field classes, one related to models that correspond to table columns and one that maps these fields to forms. This works ok for the

Re: A critic of Guido's blog on Python's lambda

2006-05-10 Thread jayessay
Michele Simionato [EMAIL PROTECTED] writes: Ken Tilton wrote: I was not thinking about the thread issue (of which I know little). The big deal for Cells is the dynamic bit: (let ((*dependent* me)) (funcall (rule me) me)) Then if a rule forces another cell to

Re: A critic of Guido's blog on Python's lambda

2006-05-10 Thread Jonathan Ellis
Randal L. Schwartz wrote: Alex == Alex Martelli [EMAIL PROTECTED] writes: Alex The difference, if any, is that gurus of Java, C++ and Python get to Alex practice and/or keep developing their respectively favorite languages Alex (since those three are the blessed general purpose languages for

Re: A critic of Guido's blog on Python's lambda

2006-05-10 Thread Ken Tilton
Chris F Clark wrote: David C Ullrich asked: Q: How do we ensure there are no loops in the dependencies? Do we actually run the whole graph through some algorithm to verify there are no loops? The question you are asking is the dependency graph a directed acyclic graph (commonly called

Re: A critic of Guido's blog on Python's lambda

2006-05-10 Thread Michele Simionato
jayessay wrote: Michele Simionato [EMAIL PROTECTED] writes: Ken Tilton wrote: I was not thinking about the thread issue (of which I know little). The big deal for Cells is the dynamic bit: (let ((*dependent* me)) (funcall (rule me) me)) Then if a rule forces

  1   2   3   >