Re: input record seperator (equivalent of "$|" of perl)

2004-12-19 Thread Fredrik Lundh
"M.E.Farmer" wrote: > What about a generator and xreadlines for those really large files: when you loop over a file object, Python uses a generator and a xreadlines- style buffering system to read data as you go. (if you check the on-line help, you'll notice that xreadlines itself is only provid

Re: Web forum (made by python)

2004-12-19 Thread Doug Holton
Gezer Punta wrote: hi all I am looking for a forum which was produced by python If you want Zope-based, try Plone. But probably you don't. I am not aware of any standard python CGI-based forum software, but I am sure you could find one if you search sourceforge or google. I am surprised no one e

Boo who? (was Re: newbie question)

2004-12-19 Thread Peter Hansen
Doug Holton wrote: Boo, a programming language that is virtually identical to python, ... See http://boo.codehaus.org/ In fact, since not many seem to be aware of its existence, I encourage everyone here to check out boo as an alternative to python. Why? If it's virtually identical, why would any

Re: Web forum (made by python)

2004-12-19 Thread Jp Calderone
On Sun, 19 Dec 2004 18:30:03 -0600, Doug Holton <[EMAIL PROTECTED]> wrote: >Gezer Punta wrote: > > > hi all > > I am looking for a forum which was produced by python > > If you want Zope-based, try Plone. But probably you don't. > I am not aware of any standard python CGI-based forum software,

Re: Web forum (made by python)

2004-12-19 Thread Doug Holton
Jp Calderone wrote: Part of fostering a friendly environment on python-list is not making comments like these. Another part is actually answering the content of a person's question like I did, instead of trolling and flaming, like Fredrik and others here are want to do. -- http://mail.python.

Re: Boo who? (was Re: newbie question)

2004-12-19 Thread Doug Holton
Peter Hansen wrote: Why? If it's virtually identical, why would anyone bother even visiting that site? ;-) But I suspect you mean that the syntax of the language is virtually identical, while probably there are some significant differences. Maybe in the richness of its standard library? Or the s

Re: Is this a good use for lambda

2004-12-19 Thread Michael Sparks
On Mon, 20 Dec 2004, Fredrik Lundh wrote: > Simo Melenius wrote: > > >> Ahem. If you name the function, you can reuse the name (or just > >> forget about it) as soon as you've used the function object. > > > > Sure, but mental pollution counts too IMO. What you write and what you > > read must go t

RE: atmosphere on c.l.py (WAS: How about "pure virtual methods"?)

2004-12-19 Thread Robert Brewer
Fredrik Lundh wrote: > well, since I'm not in the ego-stroking business, what if I > promise never to > reply to posts by you, robert, and alex? ?? I'll take your replies anytime. You're a long way from all noise and no signal. I'm happy to learn what I can from you. Robert Brewer MIS Amor Mini

Re: Web forum (made by python)

2004-12-19 Thread Choe, Cheng-Dae
try http://kldp.net/projects/pybb/ example site is http://bbs.pythonworld.net:9080/pybbs.py On Sun, 19 Dec 2004 22:09:52 +0200, Gezer Punta <[EMAIL PROTECTED]> wrote: > hi all > I am looking for a forum which was produced by python > > link pls > -- > http://mail.python.org/mailman/listinfo/pyt

Re: Boo who? (was Re: newbie question)

2004-12-19 Thread Luis M. Gonzalez
> Why? If it's virtually identical, why would anyone bother even > visiting that site? ;-) > > But I suspect you mean that the syntax of the language is virtually > identical, while probably there are some significant differences. > Maybe in the richness of its standard library? Or the size of

Re: atmosphere on c.l.py (WAS: How about "pure virtual methods"?)

2004-12-19 Thread Simon Wittber
> I do understand the feeling though; Fredrik Lundh jumped at me only a > few days ago when I said that I personally found list comprehensions > more readable than map. I certainly don't mind being advised or > corrected if I've written incorrect or even just suboptimal code, but > attacking a per

Re: Web forum (made by python)

2004-12-19 Thread Jp Calderone
On Sun, 19 Dec 2004 18:45:12 -0600, Doug Holton <[EMAIL PROTECTED]> wrote: >Jp Calderone wrote: > > Part of fostering a friendly environment on python-list is not making > > comments like these. > > Another part is actually answering the content of a person's question > like I did, instead of

Funny story about python

2004-12-19 Thread eScrewDotCom
eScrew Welcome to eScrew! eScrew is eScrew and this is eScrew story. eScrew will tell you eScrew story if you promise eScrew to consider eScrew story as joke. eScrew story is very funny. eScrew story is so funny that eScrew will have to take break from time to time because eScrew needs some rest f

Re: A completely silly question

2004-12-19 Thread Jp Calderone
On Sun, 19 Dec 2004 23:15:40 GMT, Keith Dart <[EMAIL PROTECTED]> wrote: >Mike Meyer wrote: > > The termios gives module gives you the tools to manipulate the tty > > directly, without invoking stty. The tty module gives you an easier > > interface to those routines. However, it's missing a setsane

Re: input record seperator (equivalent of "$|" of perl)

2004-12-19 Thread M.E.Farmer
Fredrik, Thanks didn't realize that about reading a file on a for loop. Slick! By the way the code I posted was an attempt at not building a monolithic memory eating list like you did to return the values in your second example. Kinda thought it would be nice to read them as needed instead of all a

Re: atmosphere on c.l.py (WAS: How about "pure virtual methods"?)

2004-12-19 Thread Fredrik Lundh
Simon Wittber wrote: > We've just had a Python 2.4 release, and poor Mr Lundh has likely had > hundreds of user's clamouring for a binary, 2.4 compatible PIL > release. many hundreds, indeed. but that's not a problem at all; I have a webserver that helps me with things like that. -- http:

Re: atmosphere on c.l.py (WAS: How about "pure virtual methods"?)

2004-12-19 Thread Doug Holton
Steven Bethard wrote: I don't really have a good solution; despite the unnecessarily vicious comments, I don't feel like I can set my newsreader to ignore messages from, for example, Fredrik, because his answers, when not attacks, are often very insightful. If you find a good solution to this p

Re: A rational proposal

2004-12-19 Thread Dave Benjamin
Hi Mike - Thanks for taking the time to put this together. In article <[EMAIL PROTECTED]>, Mike Meyer wrote: > - max(*args): return the largest of a list of numbers and self. > - min(*args): return the smallest of a list of numbers and self. I would strongly prefer either adapting the already bui

Re: input record seperator (equivalent of "$|" of perl)

2004-12-19 Thread Scott David Daniels
M.E.Farmer wrote: I dont have itertools yet. That module looks like it rocks. thanks for the pointers, M.E.Farmer If you have python 2.3 or 2.4, you have itertools. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Web forum (made by python)

2004-12-19 Thread Peter Hansen
Doug Holton wrote: Jp Calderone wrote: Part of fostering a friendly environment on python-list is not making comments like these. Another part is actually answering the content of a person's question like I did, instead of trolling and flaming, like Fredrik and others here are want to do. Non

Re: Boo who? (was Re: newbie question)

2004-12-19 Thread Peter Hansen
Luis M. Gonzalez wrote: Why? If it's virtually identical, why would anyone bother even visiting that site? ;-) The difference is that it runs on the .NET frmework (and Mono). So instead of using the python standard libraries, you use the .NET ones. Regarding its syntax, it is very similar to Pyth

Re: Easy "here documents" ??

2004-12-19 Thread Bengt Richter
On Sun, 19 Dec 2004 16:46:34 +0100, "Fredrik Lundh" <[EMAIL PROTECTED]> wrote: >Jerry Sievers wrote: > >> It gets uglier though if you want to do this from inside a function >> and have variables from more than one scope interpolated. For that >> you need something that can treat a series of dict

Re: Boo who? (was Re: newbie question)

2004-12-19 Thread Doug Holton
Peter Hansen wrote: "Virtually identical" indeed. :-) As noted on the website that I've pointed out to you multiple times now, the syntax of boo is indeed virtually identical to python. The functionality however, is more like C#. -- http://mail.python.org/mailman/listinfo/python-list

Re: Web forum (made by python)

2004-12-19 Thread Doug Holton
Peter Hansen wrote: None of which in any way invalidates Jp's point... Neither does it invalidate mine. What is up with the trollers today? They are out in force now that the holidays are here. -- http://mail.python.org/mailman/listinfo/python-list

ANN: Python Multimedia Computing book and software

2004-12-19 Thread Doug Holton
This book is due to be published any day now: "Introduction to computing and programming with Python: A Multimedia Approach" by Mark Guzdial, a CS professor at Georgia Tech. It uses the Jython Environment for Students (JES). It is completely free and open source. You can use it for example to

Re: input record seperator (equivalent of "$|" of perl)

2004-12-19 Thread M.E.Farmer
Yea I should have mentioned I am running python 2.2.2. Can it be ported to python 2.2.2? Till they get python 2.4 all up and runningI'll wait a bit. Thanks for the info, M.E.Farmer Scott David Daniels wrote: > M.E.Farmer wrote: > > I dont have itertools yet. That module looks like it rocks. >

Re: A completely silly question

2004-12-19 Thread Keith Dart
Jp Calderone wrote: On Sun, 19 Dec 2004 23:15:40 GMT, Keith Dart <[EMAIL PROTECTED]> wrote: Mike Meyer wrote: The termios gives module gives you the tools to manipulate the tty directly, without invoking stty. The tty module gives you an easier interface to those routines. However, it's missing a s

No acceptable C compiler was found in $PATH

2004-12-19 Thread banaticus
What does this error message mean? What can I do to fix it? Here'e the command that I just tried running, and the messages that I received. I just barely unpacked python. linux:/Python-2.4 # ./configure checking MACHDEP... linux2 checking EXTRAPLATDIR... checking for --without-gcc... n

Writev

2004-12-19 Thread Adam DePrince
Often I've written code that generates some textual output and dumps said output to a file or socket. Of course, we are all familiar with the performance impact (multiple copies of text data and O(n**2) performance) associated with the naive approach of: string += "some other string" string +=

Re: Easy "here documents" ??

2004-12-19 Thread John Roth
"Jim Hill" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] I've done some Googling around on this and it seems like creating a here document is a bit tricky with Python. Trivial via triple-quoted strings if there's no need for variable interpolation but requiring a long, long formatte

Re: expression form of one-to-many dict?

2004-12-19 Thread Bengt Richter
On Sun, 19 Dec 2004 21:29:27 +0100, "Fredrik Lundh" <[EMAIL PROTECTED]> wrote: >Mike Meyer wrote: > >> Personally, I'd love a language feature that let you create a function >> that didn't evaluate arguments until they were actually used - lazy >> evaluation. That lets you write the C ?: operator

Re: Web forum (made by python)

2004-12-19 Thread bitshadow
I have to say i'm really impressed at that fledgling progject choe, the only problem i could see is that it seemed to have problems connecting to the database everytime. I think pybbs is a wonderful idea and a great think to give back to the commnity. I will keep checking on your sites for future

Re: Is this a good use for lambda

2004-12-19 Thread Bengt Richter
On Sun, 19 Dec 2004 20:59:43 +0100, "Fredrik Lundh" <[EMAIL PROTECTED]> wrote: >Walter S. Leipold wrote: > >> I think that Charlie's point is that, when you use "def ", you have >> polluting your namespace. The whole program becomes harder to >> understand because you can't ignore anywhere, eve

Re: Writev

2004-12-19 Thread Jp Calderone
On Sun, 19 Dec 2004 23:12:27 -0500, Adam DePrince <[EMAIL PROTECTED]> wrote: > [snip] > > Of course, to take advantage of this requires that writev be exposed. I > have an implementation of writev. This implementation is reasonably > smart, it "unrolls" only so as many iteration.next calls as ne

Re: dot products

2004-12-19 Thread Rahul
Raymond Hettinger wrote: > [Rahul]. > > I want to compute dot product of two vectors stored as lists a and b.a > > and b are of the same length. > > > > one simple way is > > sum(a[i]*b[i] for i in range(len(a))) > > > > another simple way is > > ans=0.0 > > for i in range(len(a)): > > ans=ans+a[i

embedding: forcing an interpreter to end

2004-12-19 Thread pdectm
I'm trying to prototype an application which runs multiple python scripts, each in its own interpreter and OS thread. I've not been able to forceable stop a script which does not respond to a request to stop. My thought was to simply call: PyThreadState_Clear(xxx); PyThreadState_Delete(xxx); //

Re: atmosphere on c.l.py (WAS: How about "pure virtual methods"?)

2004-12-19 Thread Steven Bethard
Doug Holton wrote: Fredrik Lundh wrote: well, since I'm not in the ego-stroking business, what if I promise never to reply to posts by you, robert, and alex? That's not fair to the rest of us though :) That's not even fair to the non-rest of us. =) As I noted, "his answers ... are often very ins

Python To Send Emails Via Outlook Express

2004-12-19 Thread ian
Hi, I'm a newbie (oh no I can here you say another one...) How can I get Python to send emails using the default windows email client (eg outlook express)? I thought I could just do the following import win32com.client s = win32com.client.Dispatch('CDO.Message') s.From = "[EMAIL PROTECTED]"

Re: Writev

2004-12-19 Thread Steven Bethard
Adam DePrince wrote: Many other programmers have faced a similar issue; cStringIO, ''.join([mydata]), map( file.write, [mydata]) are but some attempts at making this process more efficient by jamming the components to be written into a sequence. I'm obviously misunderstanding something because I ca

Re: Python To Send Emails Via Outlook Express

2004-12-19 Thread Ganesan R
> "ian" == ian <[EMAIL PROTECTED]> writes: > import win32com.client > s = win32com.client.Dispatch('CDO.Message') > s.From = "[EMAIL PROTECTED]" > s.To = "[EMAIL PROTECTED]" > s.Subject = "The subject" > s.Send > ... but nothing happens. > What am I doing wrong? Does anyone have some sampl

Re: dot products

2004-12-19 Thread Bengt Richter
On 19 Dec 2004 03:04:15 -0800, "Rahul" <[EMAIL PROTECTED]> wrote: >HI. >I want to compute dot product of two vectors stored as lists a and b.a >and b are of the same length. > >one simple way is >sum(a[i]*b[i] for i in range(len(a))) > >another simple way is >ans=0.0 >for i in range(len(a)): >ans=

Re: Writev

2004-12-19 Thread Adam DePrince
On Sun, 2004-12-19 at 23:43, Jp Calderone wrote: > On Sun, 19 Dec 2004 23:12:27 -0500, Adam DePrince <[EMAIL PROTECTED]> wrote: > > [snip] [snip] to free the memory, of course. > > The support of iterators is a cool idea, but I'm not sure > it is actually useful. Consider the case where not

another layer for a DBMS?

2004-12-19 Thread [EMAIL PROTECTED]
I call it "DBITM" or database internal text messaging. For a free writing of this, send email to: [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Python To Send Emails Via Outlook Express

2004-12-19 Thread ian
Hi Ganesan I tried changing s.Send to s.Send(). It now comes up with an exception error.. The details are below. Ian Traceback (most recent call last): File "C:\Python23\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 307, in RunScript debugger.run(codeObject, __main__.__dict__

Re: Easy "here documents" ??

2004-12-19 Thread Jim Hill
Nick Craig-Wood wrote: >Jim Hill <[EMAIL PROTECTED]> wrote: >> Is there a way to produce a very long multiline string of output with >> variables' values inserted without having to resort to this wacky >> """v = %s"""%(variable) >I prefer this > > ... I'll have %(amount)s %(what)s > ... f

Re: Easy "here documents" ??

2004-12-19 Thread Jim Hill
Fredrik Lundh wrote: >Scott David Daniels wrote: > >> And if you enjoy building insecure stuff, try: >> >> def fix(text, globals_=None, locals=None, quote='"'): >> d = (globals_ or locals or globals()).copy() >> source = text.split(quote) >> source[1::2] = (str(eval(expr

Re: Easy "here documents" ??

2004-12-19 Thread Jim Hill
Keith Dart wrote: >Jim Hill wrote: >> Is there a way to produce a very long multiline string of output with >> variables' values inserted without having to resort to this wacky > >I was thinking about this. But I can't think of any reason why you would >want to do this in Python. What's wrong wit

Re: Easy "here documents" ??

2004-12-19 Thread Jim Hill
John Roth wrote: [Here docs] >I'm not sure why you'd want to do this, though. >It seems like it would be mostly useful in a style >of programming that's quite foreign to the way >Python wants to be programmed. I'm going to try some of the suggestions that others have floated but I think you've re

Re: Writev

2004-12-19 Thread Adam DePrince
On Mon, 2004-12-20 at 00:30, Steven Bethard wrote: > Adam DePrince wrote: > > Many other programmers have faced a similar issue; cStringIO, > > ''.join([mydata]), map( file.write, [mydata]) are but some attempts at > > making this process more efficient by jamming the components to be > > written i

Re: atmosphere on c.l.py (WAS: How about "pure virtual methods"?)

2004-12-19 Thread Doug Holton
Steven Bethard wrote: Doug Holton wrote: Fredrik Lundh wrote: well, since I'm not in the ego-stroking business, what if I promise never to reply to posts by you, robert, and alex? That's not fair to the rest of us though :) That's not even fair to the non-rest of us. =) As I noted, "his answers

Re: No acceptable C compiler was found in $PATH

2004-12-19 Thread Fredrik Lundh
"banaticus" <[EMAIL PROTECTED]> wrote: > What does this error message mean? What can I do to fix it? it usually means what it says... (read on) > Here'e the command that I just tried running, and the messages that > I received. I just barely unpacked python. > > linux:/Python-2.4 # ./configure

Re: Easy "here documents" ??

2004-12-19 Thread Fredrik Lundh
Jim Hill wrote: >>And if you prefer not to type so much: >> >>def I(*args): return "".join(map(str, args)) >>def F(v, fmt): return ("%" + fmt) % v > > Not that I don't appreciate the suggestions from masters of the Python > universe, but the reason I'm switching to Python from Perl is for the > re

Re: Is this a good use for lambda

2004-12-19 Thread Fredrik Lundh
Bengt Richter wrote: >>Ahem. If you name the function, you can reuse the name (or just forget about >>it) >>as soon as you've used the function object. >> >>If you don't want to reuse the name because you might want to reuse the >>function >>object, you have to name it anyway. >> > Are you forg

Re: Python To Send Emails Via Outlook Express

2004-12-19 Thread Fredrik Lundh
<[EMAIL PROTECTED]> wrote: > I tried changing s.Send to s.Send(). It now comes up with an exception > error.. > com_error: (-2147352567, 'Exception occurred.', (0, None, 'The server > rejected one or more recipient addresses. The server response was: 554 > <[EMAIL PROTECTED]>: Relay access denied

how to pass globals across modules (wxPython)

2004-12-19 Thread Martin Drautzburg
My wxPython program starts execution in mainFrame.py like this [...] class MainApp(wxApp): def OnInit(self): self.mainFrame = MainFrame(None) self.mainFrame.Show() self.SetTopWindow(self.mainFram

Re: Writev

2004-12-19 Thread Steven Bethard
Adam DePrince wrote: file.writelines( seq ) and map( file.write, seq ) are the same; the former is syntactic sugar for the later. Well, that's not exactly true. For one thing, map(file.write, seq) returns a list of Nones, while file.writelines returns only the single None that Python functions w

accessing module global vars by name

2004-12-19 Thread Martin Drautzburg
Withing a module I can assign a value to a global var by assigning to it in the outermost scope. Fine. But how can I do this if the attribute name itself is kept in a variable. Once the module is loaded I can access the module's namespace no problem, but inside the module the dictionary is not yet

Re: Python To Send Emails Via Outlook Express

2004-12-19 Thread ian
Thanks Fredrik, That was my first impression too. But all I want to do is use Python to instruct Outlook Express to send an email. That way the user would not have to do any setting up etc of the mail server properties etc and Outlook Express will magage all the connection side of things. I have

Re: atmosphere on c.l.py (WAS: How about "pure virtual methods"?)

2004-12-19 Thread Steven Bethard
Doug Holton wrote: He was only acknowledging the problem to those 3 people who complained about it. I was making the point that others do not like being trolled either. Ahh, gotcha. Read your comment with the right intonation this time. =) Steve -- http://mail.python.org/mailman/listinfo/python

Re: Easy "here documents" ??

2004-12-19 Thread Fredrik Lundh
Jim Hill wrote: > I'm trying to write a script that writes a script for a rather specialized > task. I know that seems weird, but the original version was written in > Korn shell and most of my team are familiar with the way it does things > even though they don't read Korn. so why didn't you te

Re: Python To Send Emails Via Outlook Express

2004-12-19 Thread Keith Dart
[EMAIL PROTECTED] wrote: Hi Ganesan I tried changing s.Send to s.Send(). It now comes up with an exception error.. The details are below. Looks like the COM part works, but sending mail has an error from the SMTP host. But, slightly off topic, FYI, Python can send email directly with the email an

Re: accessing module global vars by name

2004-12-19 Thread Steven Bethard
Martin Drautzburg wrote: IOW how can I write something like # xxx.py for varName in ("foo", "bar"): magic.varName = 1 I think you want to use the dict returned by globals(). Modifying this dict can add/remove names from the global scope.[1] >>> foo Traceback (most recent call last): Fi

Re: Python To Send Emails Via Outlook Express

2004-12-19 Thread Max M
[EMAIL PROTECTED] wrote: Thanks Fredrik, That was my first impression too. But all I want to do is use Python to instruct Outlook Express to send an email. Which you did! From the look of the traceback. But your mailserver is configured in such a way that you cannot send mail from your machine us

Re: how to pass globals across modules (wxPython)

2004-12-19 Thread Fredrik Lundh
Martin Drautzburg wrote: > My wxPython program starts execution in mainFrame.py like this >[...] >class MainApp(wxApp): >def OnInit(self): >self.mainFrame = MainFrame(None) >self.mainFrame.Show() >

Re: Easy "here documents" ??

2004-12-19 Thread Keith Dart
Fredrik Lundh wrote: Jim Hill wrote: I'm trying to write a script that writes a script for a rather specialized task. I know that seems weird, but the original version was written in Korn shell and most of my team are familiar with the way it does things even though they don't read Korn. so why

Re: Python To Send Emails Via Outlook Express

2004-12-19 Thread Fredrik Lundh
<[EMAIL PROTECTED]> wrote: > But all I want to do is use Python to instruct Outlook Express to send > an email. and you succeeded -- the error message you saw came from the mail server, not outlook itself. your problem is that the server didn't like the mail you sent; checking the server config

Re: Python To Send Emails Via Outlook Express

2004-12-19 Thread ian
Hi Keith Thanks for your reply. I am aware of the smtplib module and it works very well! (refer script below) The problem is that I have a developed a freeware application called Kirby Alarm And Task Scheduler (see www.kirbyfooty.com). The program can pop up a note, run a program, play a sound, o

<    1   2