Re: List mutation method gotcha - How well known?

2008-03-15 Thread Marc 'BlackJack' Rintsch
On Fri, 14 Mar 2008 11:32:41 -0700, Lie wrote: No, there is no need for void return type, what I meant is that everything that's not said in the documentation should be assumed to be an implementation detail, a method or a function that doesn't say anything about its return type should be

Re: How to import custom python file in python server page (psp) ?

2008-03-15 Thread Graham Dumpleton
On Mar 15, 6:44 am, Joshua Kugler [EMAIL PROTECTED] wrote: James Yu wrote: Hi folks, I prepared a python script for dynamically get the absolute paths of the files in certain folder. Then I tried to invoke that function from my web server in a .psp file like this:       1 html    

Re: Handling global variables (Newbie)

2008-03-15 Thread Marc 'BlackJack' Rintsch
On Fri, 14 Mar 2008 12:19:18 -0700, MRAB wrote: On Mar 13, 4:25 am, David S [EMAIL PROTECTED] wrote: Hi, I have an error occurring at self.build_root = os.path.abspath(os.path.split(__file__)[0]) The error states 'NameError: global name '__file__' is not defined' In Python 2.5 I

Re: request for Details about Dictionaries in Python

2008-03-15 Thread Marc 'BlackJack' Rintsch
On Fri, 14 Mar 2008 17:06:00 +, Matt Nordhoff wrote: Hmm, if Perl's on-disk hash tables are good, maybe someone should port them to Python, or maybe someone already has. I don't know Perl's on-disk hash tables but there is a `shelve` module in the standard library. Ciao, Marc

Re: call by reference howto????

2008-03-15 Thread castironpi
On Mar 15, 12:39 am, Dennis Lee Bieber [EMAIL PROTECTED] wrote: On 14 Mar 2008 10:38:52 GMT, Antoon Pardon [EMAIL PROTECTED] declaimed the following in comp.lang.python: In that case I find it very strange that when this question comes up, I see so few attempts to explain how the assignment

Re: Handling global variables (Newbie)

2008-03-15 Thread Gabriel Genellina
En Thu, 13 Mar 2008 02:25:12 -0200, David S [EMAIL PROTECTED] escribi�: I have an error occurring at self.build_root = os.path.abspath(os.path.split(__file__)[0]) The error states 'NameError: global name '__file__' is not defined' In Python 2.5 I ran my script as a module in IDLE gui.

Re: Socket Performance

2008-03-15 Thread Gabriel Genellina
En Thu, 13 Mar 2008 15:18:44 -0200, [EMAIL PROTECTED] escribió: Well, lets say you have a situation where you're going to be alternating between sending large and small chunks of data. Is the solution to create a NetworkBuffer class and only call send when the buffer is full, always

Re: List mutation method gotcha - How well known?

2008-03-15 Thread Hendrik van Rooyen
On Thu, Mar 13, 2008 at 8:36 AM, Hendrik van Rooyen [EMAIL PROTECTED] wrote: foo = [1,2,3,4] x = foo.append(5) print x What will be the output (choose one): 1) [1,2,3,4] 2) [1,2,3,4,5] 3) That famous picture of Albert Einstein sticking out his tongue 4) Nothing - no output

Re: Socket Performance

2008-03-15 Thread castironpi
On Mar 15, 3:33 am, Gabriel Genellina [EMAIL PROTECTED] wrote: En Thu, 13 Mar 2008 15:18:44 -0200, [EMAIL PROTECTED] escribió: Well, lets say you have a situation where you're going to be alternating between sending large and small chunks of data. Is the solution to create a NetworkBuffer

Re: unitests don't run under pdb

2008-03-15 Thread Gabriel Genellina
En Fri, 14 Mar 2008 17:23:14 -0200, Amit Gupta [EMAIL PROTECTED] escribi�: On Feb 20, 8:51 pm, Miki [EMAIL PROTECTED] wrote: Hello Amit, python testname.py : the unitests runs as usual and I get the following results:

ImportError while Embedding python in C

2008-03-15 Thread kaush
Hi All, I have a simple python script saved to test.py as import os import base64 def Testfunction(): print Hello World return Testfunction() I am trying to invoke this from a C program as follows int main(int argc, char* argv[]) { Py_Initialize(); PyObject*

Re: unitests don't run under pdb

2008-03-15 Thread Gabriel Genellina
En Fri, 14 Mar 2008 17:23:14 -0200, Amit Gupta [EMAIL PROTECTED] escribi�: So What do I do, if my testcase if failing because of an uncaught exception and I want to run it in pdb. Oh, sorry, my last message doesn't apply because the unittest framework caughts the exception. Looks like you

Re: ImportError while Embedding python in C

2008-03-15 Thread kaush
On Mar 15, 2:10 am, kaush [EMAIL PROTECTED] wrote: Hi All, I have a simple python script saved to test.py as import os import base64 def Testfunction(): print Hello World return Testfunction() I am trying to invoke this from a C program as follows int main(int argc, char*

Re: Joseph Weizenbaum

2008-03-15 Thread Arnaud Delobelle
On Mar 15, 5:47 am, Tim Roberts [EMAIL PROTECTED] wrote: Jeff Schwab [EMAIL PROTECTED] wrote: Roel Schroeven wrote: [EMAIL PROTECTED] schreef: On Mar 14, 1:47 pm, Reedick, Andrew [EMAIL PROTECTED] wrote: Subject: RIP: Joseph Weizenbaum Creator of Eliza:

Python for Palm OS

2008-03-15 Thread E-Lo
Is there any other edition of Python for Palm OS instead of Pippy? -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there Python equivalent to Perl BEGIN{} block?

2008-03-15 Thread Alex
On Mar 15, 5:42 am, Carl Banks [EMAIL PROTECTED] wrote: On Mar 14, 6:37 pm, Alex [EMAIL PROTECTED] wrote: On Mar 13, 6:21 pm, Carl Banks [EMAIL PROTECTED] wrote: On Mar 13, 7:02 am, Bruno Desthuilliers bruno. [EMAIL PROTECTED] wrote: Alex a écrit : (sni) First of all

I found affordable health insurance.

2008-03-15 Thread MSmith
I couldn't believe it. Do yourself a favour and at least check it out: http://www.jdoqocy.com/click-2924912-10359791 Michael -- http://mail.python.org/mailman/listinfo/python-list

Re: Spaces in path name

2008-03-15 Thread Tim Golden
joep wrote: I had the same problem recently with subprocess.popen, when there is a space in the executable and a space in an additional argument as in the acrobat example. I finally found a past thread in this news group that explained that you have to use two (2) leading double quotes, and

Re: Python for Palm OS

2008-03-15 Thread Malcolm Greene
E-Lo, PalmPython http://c2.com/cgi/wiki?PalmPython I have no experience with Python for Palm OS's. This is just a reference from my personal notes. Malcolm -- http://mail.python.org/mailman/listinfo/python-list

Re: Python-list Digest, Vol 54, Issue 199

2008-03-15 Thread Thomas Boland
what the? why can this get through? [EMAIL PROTECTED] wrote: Send Python-list mailing list submissions to python-list@python.org To subscribe or unsubscribe via the World Wide Web, visit http://mail.python.org/mailman/listinfo/python-list or, via email, send a message with

Re: Socket Performance

2008-03-15 Thread Bryan Olson
[EMAIL PROTECTED] wrote: Gabriel Genellina wrote: No need to reinvent the wheel. socket objects already have a makefile method returning a file-like object, which behaves like a buffered socket. That wheel is far from round, and needs some reinvention. Python's file-like objects do not play

Using threads in python is safe ?

2008-03-15 Thread Deepak Rokade
Hi All, I want to use therads in my application. Going through the docs , I read about GIL. Now I am confused whether using threads in python is safe or not. One thing I know that if I am accessing global variables in two or more threads I need to synchronize them using locking or such mechanism

Python for BlackBerry

2008-03-15 Thread Sandipan Gangopadhyay
Is there a Python for BlackBerry? Thanks. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of E-Lo Sent: Saturday, March 15, 2008 6:03 AM To: python-list@python.org Subject: Python for Palm OS Is there any other edition of Python for Palm OS instead of

Re: Joseph Weizenbaum

2008-03-15 Thread castironpi
On Mar 15, 4:56 am, Arnaud Delobelle [EMAIL PROTECTED] wrote: On Mar 15, 5:47 am, Tim Roberts [EMAIL PROTECTED] wrote: Jeff Schwab [EMAIL PROTECTED] wrote: Roel Schroeven wrote: [EMAIL PROTECTED] schreef: On Mar 14, 1:47 pm, Reedick, Andrew [EMAIL PROTECTED] wrote: Subject: RIP:

string literal or NoneType

2008-03-15 Thread menosaint
hi all i want to check a condition and if true should return a filename string from a list.if the condition is false i am returning a (string literal).. retv= if somecondition: retv=mylist[x] ... return retv The calling function will check the return value and print the filename if it

Exciting FREE Details

2008-03-15 Thread sreya9636
Tips On Buying A Desktop Computer While the case may not be important to some computer users it is a consideration to be thought about before purchasing a desktop computer. ... Log on : http://www.computer-solution.page.tl -- http://mail.python.org/mailman/listinfo/python-list

Re: Joseph Weizenbaum

2008-03-15 Thread Aahz
In article [EMAIL PROTECTED], Tim Roberts [EMAIL PROTECTED] wrote: Jeff Schwab [EMAIL PROTECTED] wrote: Roel Schroeven wrote: [EMAIL PROTECTED] schreef: On Mar 14, 1:47 pm, Reedick, Andrew [EMAIL PROTECTED] wrote: How do you feel about creator of Eliza? What is Eliza? Does that question

Re: call by reference howto????

2008-03-15 Thread sturlamolden
On 28 Feb, 02:24, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: Python doesn't do call by reference. Nor does it do call by value. Please pay no attention to anyone who says it does. Exactly. Python pass variables the same way as Lisp, which is neither call-by-value (cf. C) nor

Unicode/UTF-8 confusion

2008-03-15 Thread Tom Stambaugh
I'm still confused about this, even after days of hacking at it. It's time I asked for help. I understand that each of you knows more about Python, Javascript, unicode, and programming than me, and I understand that each of you has a higher SAT score than me. So please try and be gentle with your

Re: call by reference howto????

2008-03-15 Thread sturlamolden
On 28 Feb, 02:24, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: Python doesn't do call by reference. Nor does it do call by value. Please pay no attention to anyone who says it does. Exactly. Python pass variables the same way as Lisp, which is neither call-by-value (cf. C) nor

Re: call by reference howto????

2008-03-15 Thread sturlamolden
On 13 Mar, 09:22, Antoon Pardon [EMAIL PROTECTED] wrote: Whatever python has for a calling convention, it is close enough that naming it call by reference gives people a reasonable idea of what is going on. Only to the extent that many mistake passing Java or C# reference types for

Unicode/UTF-8 confusion

2008-03-15 Thread Tom Stambaugh
I'm still confused about this, even after days of hacking at it. It's time I asked for help. I understand that each of you knows more about Python, Javascript, unicode, and programming than me, and I understand that each of you has a higher SAT score than me. So please try and be gentle with

Re: Unicode/UTF-8 confusion

2008-03-15 Thread Marc 'BlackJack' Rintsch
On Sat, 15 Mar 2008 12:09:19 -0400, Tom Stambaugh wrote: I'm still confused about this, even after days of hacking at it. It's time I asked for help. I understand that each of you knows more about Python, Javascript, unicode, and programming than me, and I understand that each of you has a

[no subject]

2008-03-15 Thread Tom Stambaugh
Somehow I don't get what you are after. The ' doesn't have to be escaped at all if are used to delimit the string. If ' are used as delimiters then \' is a correct escaping. What is the problem with that!? If I delimit the string with double quote, then I have to escape every double quote

Re: Unicode/UTF-8 confusion

2008-03-15 Thread Tom Stambaugh
Somehow I don't get what you are after. The ' doesn't have to be escaped at all if are used to delimit the string. If ' are used as delimiters then \' is a correct escaping. What is the problem with that!? If I delimit the string with double quote, then I have to escape every double quote

Re: Joseph Weizenbaum

2008-03-15 Thread Jeff Schwab
Aahz wrote: In article [EMAIL PROTECTED], Tim Roberts [EMAIL PROTECTED] wrote: Jeff Schwab [EMAIL PROTECTED] wrote: Roel Schroeven wrote: [EMAIL PROTECTED] schreef: On Mar 14, 1:47 pm, Reedick, Andrew [EMAIL PROTECTED] wrote: How do you feel about creator of Eliza? What is Eliza? Does

Getting started with OS X Leopard

2008-03-15 Thread Mark Carter
One thing I really liked about Ubuntu was that Nautilus allowed you to add scripts to a directory which could be accessed via the RMB. It was a very simple thing to do. I've recently switched to Leopard, and I'm trying to do the same thing. I'm fairly experienced with Python, but new to OS X.

Re: Huge problem gettng MySQLdb to work on my mac mini running Macosx 10.5 Leopard

2008-03-15 Thread geert
On Mar 14, 11:49 am, Robert Rawlins [EMAIL PROTECTED] wrote: Geert, I've not seen this issue myself, however, you might get a little more luck asking over on theMySQLdbmailing list as this seems to be more an issue with the db than your python code. It might be worth posting your question

Re: Creating a file with $SIZE

2008-03-15 Thread rbossy
Quoting Bryan Olson [EMAIL PROTECTED]: Robert Bossy wrote: Bryan Olson wrote: Robert Bossy wrote: Robert Bossy wrote: Indeed! Maybe the best choice for chunksize would be the file's buffer size... That bit strikes me as silly. The size of the chunk must be as little as possible

Re: Joseph Weizenbaum

2008-03-15 Thread Aahz
In article [EMAIL PROTECTED], Jeff Schwab [EMAIL PROTECTED] wrote: Aahz wrote: In article [EMAIL PROTECTED], Tim Roberts [EMAIL PROTECTED] wrote: I am embarrassed to say that this vaguely disrespectful exchange made me laugh out loud. Serious: why do you think this is disrespectful?

Re: Getting started with OS X Leopard

2008-03-15 Thread has
On 15 Mar, 18:05, Mark Carter [EMAIL PROTECTED] wrote: The sorts of things I want to do are: * copy the directory of Finder to the clipboard * add a new file to Finder's directory. * find out the size of a directory * open a file with Aquamacs, regardless of file type, If you want to control

Re: Unicode/UTF-8 confusion

2008-03-15 Thread Matt Nordhoff
Tom Stambaugh wrote: I'm still confused about this, even after days of hacking at it. It's time I asked for help. I understand that each of you knows more about Python, Javascript, unicode, and programming than me, and I understand that each of you has a higher SAT score than me. So please try

Re: Unicode/UTF-8 confusion

2008-03-15 Thread Carsten Haese
On Sat, 2008-03-15 at 12:09 -0400, Tom Stambaugh wrote: [...] I use simplejson to serialize html strings that the server is delivering to a browser. Since the apostrophe is a string terminator in javascript, I need to escape any apostrophe embedded in the html. [...] simplejson escapes

Re: Unicode/UTF-8 confusion

2008-03-15 Thread Carsten Haese
On Sat, 2008-03-15 at 20:03 +0100, Carsten Haese wrote: On Sat, 2008-03-15 at 12:09 -0400, Tom Stambaugh wrote: [...] I use simplejson to serialize html strings that the server is delivering to a browser. Since the apostrophe is a string terminator in javascript, I need to escape any

Re: Unicode/UTF-8 confusion

2008-03-15 Thread Marc Christiansen
Tom Stambaugh [EMAIL PROTECTED] wrote: Somehow I don't get what you are after. The ' doesn't have to be escaped at all if are used to delimit the string. If ' are used as delimiters then \' is a correct escaping. What is the problem with that!? If I delimit the string with double quote,

Weight Problem

2008-03-15 Thread Ravi Kumar
An Interesting problem, A man has only 4 bricks of different weights, lies between 1-40KG, Also, the total weights of Brick A, B, C, D (ie A+B+C+D) is 40KG. The man uses that brick to calculate every possible weight from 1 KG to 40 KG in his shop. (only whole numbers 1KG, 2KG etc, not like

Re: string literal or NoneType

2008-03-15 Thread Terry Reedy
[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] | hi all | i want to check a condition and if true should return a filename | string from a list.if the condition is false i am returning a | (string literal).. | | retv= | if somecondition: |retv=mylist[x] | ... | return retv | |

Re: Unicode/UTF-8 confusion

2008-03-15 Thread Tom Stambaugh
I appreciate the answers the community has provided, I think I need to add some additional context. I use a trick to let me pass the information into my browser client application. The browser requests the server information from a form whose target is a hidden iframe. The string the server

Re: Getting started with OS X Leopard

2008-03-15 Thread Mark Carter
has wrote: On 15 Mar, 18:05, Mark Carter [EMAIL PROTECTED] wrote: The sorts of things I want to do are: * copy the directory of Finder to the clipboard * add a new file to Finder's directory. * find out the size of a directory * open a file with Aquamacs, regardless of file type, If you

Re: Getting started with OS X Leopard

2008-03-15 Thread Arnaud Delobelle
On Mar 15, 7:31 pm, Mark Carter [EMAIL PROTECTED] wrote: has wrote: On 15 Mar, 18:05, Mark Carter [EMAIL PROTECTED] wrote: The sorts of things I want to do are: * copy the directory of Finder to the clipboard * add a new file to Finder's directory. * find out the size of a directory *

Cannot install SOAPpy

2008-03-15 Thread shaq . koby
I installed SOAPpy on my server with Python 2.5. But now everytime I exit, I get the following error: Exception exceptions.AttributeError: '_shutdown' in module 'threading' from '/home/mhagen/lib/python2.5/threading.pyc' ignored Here is the command line output: [EMAIL PROTECTED]:~$ python

Re: Getting started with OS X Leopard

2008-03-15 Thread Mark Carter
Arnaud Delobelle wrote: Is there a particular reason you want python from MacPorts? OSX Leopard comes with python 2.5, that's what I use on my mac. I heard from somewhere that Apple's version was a bit wonky, and that I would be better off with a proper build. --

Python and 3D

2008-03-15 Thread Eric von Horst
Hi, I am looking for Python modules that allow you to manipulate 3D objects, more specifically Alias Wavefront .OBJ objects. Also, a module that would allow you to vizualize these models and rotate them etc.. The goal is not to build a new renderer or something; just a small program that I need

Code to send RSS news by Sendmail

2008-03-15 Thread Ulysse
Hello, I'm searching a code which allow you to parse each item in the RSS feed, get the news page of each item, convert it to text and send it by mail. Do you know if it exists ? Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting started with OS X Leopard

2008-03-15 Thread Kevin Walzer
Mark Carter wrote: Arnaud Delobelle wrote: Is there a particular reason you want python from MacPorts? OSX Leopard comes with python 2.5, that's what I use on my mac. I heard from somewhere that Apple's version was a bit wonky, and that I would be better off with a proper build. Not

Python Generators

2008-03-15 Thread mpc
HI all, I am trying to write a while loop that will iterate over generators to capture all the headers of FFCache directories. However, the generators embedded within the argument of another generator do not seem to re-initiate. the example below loops through and initiates the generator embedded

Re: Getting started with OS X Leopard

2008-03-15 Thread martin . laloux
if you are not satisfied with the native version, why not install the official version directly from python site http://www.python.org/download/ (macpython) instead of using that of macports. It moreover is provided with many utilities There is a macpython list that you can consult at

replace string in a file

2008-03-15 Thread Unknown
Hi, I've got this code : cb = open(testfile, r+) f = cb.readlines() for line in f: rx = re.match(r'^\s*(\d+).*', line) if not rx: continue else: serial = rx.group(1) now = time.time() today = time.strftime('%Y%m%d00', time.localtime(now))

Re: replace string in a file

2008-03-15 Thread andrei . avk
On Mar 15, 3:54 pm, Unknown [EMAIL PROTECTED] wrote: Hi, I've got this code : cb = open(testfile, r+) f = cb.readlines() for line in f:     rx = re.match(r'^\s*(\d+).*', line)     if not rx:         continue     else:         serial = rx.group(1)         now = time.time()        

Re: Python Generators

2008-03-15 Thread sturlamolden
On 15 Mar, 21:35, mpc [EMAIL PROTECTED] wrote: generator embedded in the argument only once. Can anyone explain while the generator will not re-initiate, and suggest a simple fix? I am not sure what you are trying to do, but it seems a bit confused. def concat(seq): for s in seq:

Re: Getting started with OS X Leopard

2008-03-15 Thread Mark Carter
[EMAIL PROTECTED] wrote: if you are not satisfied with the native version, why not install the official version directly from python site http://www.python.org/download/ (macpython) instead of using that of macports. It moreover is provided with many utilities There is a macpython list that

Re: Spaces in path name

2008-03-15 Thread joep
http://timgolden.me.uk/python/win32_how_do_i/run-a-command-with-a-spa... Note: this works for subprocess.call but for subprocess.Popen this does not work if there are two arguments in the command line with spaces. Especially, even after trying out many different versions, I never managed to get

Re: Convert int to float

2008-03-15 Thread Grant Edwards
On 2008-03-15, Guido van Brakel [EMAIL PROTECTED] wrote: Hello I have this now: def gem(a): g = sum(a) / len(a) g = float(sum(a)) / len(a) return g It now gives a int, but i would like to see floats. How can integrate that into the function? See above. Life is like a

Re: Convert int to float

2008-03-15 Thread sturlamolden
On 15 Mar, 22:43, Guido van Brakel [EMAIL PROTECTED] wrote: def gem(a): g = sum(a) / len(a) return g It now gives a int, but i would like to see floats. How can integrate that into the function? You get an int because you are doing integer division. Cast one int to float. def

Convert int to float

2008-03-15 Thread Guido van Brakel
Hello I have this now: def gem(a): g = sum(a) / len(a) return g print gem([1,2,3,4]) print gem([1,10,100,1000]) print gem([1,-2,3,-4,5]) It now gives a int, but I would like to see floats. How can I integrate that into the function? Regards, -- Guido van Brakel Life

Re: Spaces in path name

2008-03-15 Thread joep
On Mar 15, 5:42 pm, joep [EMAIL PROTECTED] wrote: http://timgolden.me.uk/python/win32_how_do_i/run-a-command-with-a-spa... Note: this works for subprocess.call but for subprocess.Popen this does not work if there are two arguments in the command line with spaces. Especially, even after trying

Re: replace string in a file

2008-03-15 Thread Unknown
Thanks, andrei. I'll try that. Le Sat, 15 Mar 2008 14:25:21 -0700, andrei.avk a écrit : What you want to do is either 1. load everything up into a string, replace text, close file, reopen it with 'w' flag, write string to it. OR if file is too big, you can read each line, replace, write to a

Re: Convert int to float

2008-03-15 Thread Guido van Brakel
Grant Edwards wrote: On 2008-03-15, Guido van Brakel [EMAIL PROTECTED] wrote: Hello I have this now: def gem(a): g = sum(a) / len(a) g = float(sum(a)) / len(a) return g Hi, Thank you very much,sometimes it is so amazing simple. Regards -- Guido van Brakel Life is

Re: Joseph Weizenbaum

2008-03-15 Thread castironpi
I am embarrassed to say that this vaguely disrespectful exchange made me laugh out loud. Serious: why do you think this is disrespectful? Not to speak for Tim, but I imagine it could be perceived as disrespectful because Prof. Weizenbaum has only recently passed away. In fact, I think

Re: Python for BlackBerry

2008-03-15 Thread Mike Driscoll
On Mar 15, 7:24 am, Sandipan Gangopadhyay [EMAIL PROTECTED] wrote: Is there a Python for BlackBerry? Thanks. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of E-Lo Sent: Saturday, March 15, 2008 6:03 AM To: [EMAIL PROTECTED] Subject: Python for Palm

Re: Python and 3D

2008-03-15 Thread Mike Driscoll
On Mar 15, 3:09 pm, Eric von Horst [EMAIL PROTECTED] wrote: Hi, I am looking for Python modules that allow you to manipulate 3D objects, more specifically Alias Wavefront .OBJ objects. Also, a module that would allow you to vizualize these models and rotate them etc.. The goal is not to

Re: Socket Performance

2008-03-15 Thread castironpi
On Mar 15, 8:18 am, Bryan Olson [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Gabriel Genellina wrote: No need to reinvent the wheel. socket objects already have a makefile   method returning a file-like object, which behaves like a buffered socket. That wheel is far from round, and

Re: Code to send RSS news by Sendmail

2008-03-15 Thread Mike Driscoll
On Mar 15, 3:18 pm, Ulysse [EMAIL PROTECTED] wrote: Hello, I'm searching a code which allow you to parse each item in the RSS feed, get the news page of each item, convert it to text and send it by mail. Do you know if it exists ? Thanks Try using Google next time. In the meantime,

Re: Python Generators

2008-03-15 Thread Peter Otten
mpc wrote: I am trying to write a while loop that will iterate over generators to capture all the headers of FFCache directories. However, the generators embedded within the argument of another generator do not seem to re-initiate. the example below loops through and initiates the generator

Re: Convert int to float

2008-03-15 Thread sturlamolden
On 15 Mar, 22:43, Guido van Brakel [EMAIL PROTECTED] wrote: def gem(a): g = sum(a) / len(a) return g print gem([1,2,3,4]) print gem([1,10,100,1000]) print gem([1,-2,3,-4,5]) gem( map(float,[1,2,3,4]) ) gem( float(i) for i in [1,2,3,4] ) --

Re: string literal or NoneType

2008-03-15 Thread castironpi
On Mar 15, 10:27 am, [EMAIL PROTECTED] wrote: hi all i want to check a condition and if true should return a filename string  from a list.if the condition is false i am returning a  (string literal).. retv= if  somecondition:     retv=mylist[x] ... return retv The calling function

Re: Convert int to float

2008-03-15 Thread Dan Bishop
On Mar 15, 4:43 pm, Guido van Brakel [EMAIL PROTECTED] wrote: Hello I have this now: def gem(a): g = sum(a) / len(a) return g print gem([1,2,3,4]) print gem([1,10,100,1000]) print gem([1,-2,3,-4,5]) It now gives a int, but i would like to see floats. How can integrate

Re: Python and 3D

2008-03-15 Thread Carl Banks
On Mar 15, 4:09 pm, Eric von Horst [EMAIL PROTECTED] wrote: Hi, I am looking for Python modules that allow you to manipulate 3D objects, more specifically Alias Wavefront .OBJ objects. Also, a module that would allow you to vizualize these models and rotate them etc.. The goal is not to

Re: Big file

2008-03-15 Thread hdante
On Mar 12, 10:50 pm, Andrew Rekdal [EMAIL PROTECTED] wrote: Well, I can see how this could get real messy but within defining a GUI there are many elements and so the block of elements such as a wx.notebook for instance I would hope I could place all the code for this in another file and

Re: replace string in a file

2008-03-15 Thread joep
you can also use standard module fileinput.input with ''inplace'' option which backs up original file automatically. from python help for fileinput: Optional in-place filtering: if the keyword argument inplace=1 is passed to input() or to the FileInput constructor, the file is moved to a backup

how can pulldom save to xml file?

2008-03-15 Thread sun
I have a large xml file parsed by pulldom. I did some editing on some node,change attributes and remove some child node, how do I save it back to this xml file or write a new xml file? The save method in minidom does not work for pulldom. Thanks --

'join' in the wrong word for the method in class Thread.

2008-03-15 Thread castironpi
'join' in the wrong word for the method in class Thread. The agent-patient semantics of calling functions can get ambiguous. It is not a problem of native Pythoners alone. Is it due to lazy programming, an inability of English (do you have it in other languages?), or not a problem at all?

os.path.isdir question

2008-03-15 Thread lampshade
Hello, I'm having some problems with os.path.isdir I think it is something simple that I'm overlooking. #!/usr/bin/python import os my_path = os.path.expanduser(~/pictures/) print my_path results = os.listdir(my_path) for a_result in results: if os.path.isdir(str(my_path) +

Re: string literal or NoneType

2008-03-15 Thread castironpi
On Mar 15, 2:41 pm, Terry Reedy [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] | hi all | i want to check a condition and if true should return a filename | string  from a list.if the condition is false i am returning a |  (string literal).. | | retv=

Re: os.path.isdir question

2008-03-15 Thread Benjamin
On Mar 15, 8:12 pm, lampshade [EMAIL PROTECTED] wrote: Hello, I'm having some problems with os.path.isdir I think it is something simple that I'm overlooking. #!/usr/bin/python import os my_path = os.path.expanduser(~/pictures/) print my_path results = os.listdir(my_path) for

Re: os.path.isdir question

2008-03-15 Thread yoz
lampshade wrote: Hello, I'm having some problems with os.path.isdir I think it is something simple that I'm overlooking. #!/usr/bin/python import os my_path = os.path.expanduser(~/pictures/) print my_path results = os.listdir(my_path) for a_result in results: if

Re: 'join' in the wrong word for the method in class Thread.

2008-03-15 Thread Benjamin
On Mar 15, 7:29 pm, [EMAIL PROTECTED] wrote: 'join' in the wrong word for the method in class Thread. The agent-patient semantics of calling functions can get ambiguous. It is not a problem of native Pythoners alone. Is it due to lazy programming, an inability of English (do you have it in

Re: os.path.isdir question

2008-03-15 Thread lampshade
On Mar 15, 9:27 pm, Benjamin [EMAIL PROTECTED] wrote: On Mar 15, 8:12 pm, lampshade [EMAIL PROTECTED] wrote: Hello, I'm having some problems with os.path.isdir I think it is something simple that I'm overlooking. #!/usr/bin/python import os my_path = os.path.expanduser(~/pictures/)

Re: os.path.isdir question

2008-03-15 Thread John Machin
On Mar 16, 12:12 pm, lampshade [EMAIL PROTECTED] wrote: Hello, I'm having some problems with os.path.isdir I think it is something simple that I'm overlooking. #!/usr/bin/python import os my_path = os.path.expanduser(~/pictures/) print my_path results = os.listdir(my_path) for

RE: Python for BlackBerry

2008-03-15 Thread Sandipan Gangopadhyay
Thanks, Mike. This one seems to be for Nokia, particularly S60 and Symbian in general. Does BlackBerry work on Symbian? Let me check. Thanks. Sandipan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mike Driscoll Sent: Saturday, March 15, 2008 6:04 PM To:

Re: Urgent : How to do memory leaks detection in python ?

2008-03-15 Thread tsuraan
Python doesn't have memory leaks. Yeah, interesting bit of trivia: python is the world's only non-trivial program that's totally free of bugs. Pretty exciting! But seriously, python 2.4, at least, does have some pretty trivially exposed memory leaks when working with strings. A simple example

Re: call by reference howto????

2008-03-15 Thread Steven D'Aprano
On Sat, 15 Mar 2008 11:50:17 -0700, Dennis Lee Bieber wrote: Small integers are cached in Python, so they always have a fixed ID (address). Small integers are cached in CPython, making it an implementation- dependent feature. I don't believe that caching is promised by the language

[issue1810] AST compile() patch

2008-03-15 Thread Thomas Lee
Thomas Lee [EMAIL PROTECTED] added the comment: Updating the patch to apply cleanly against HEAD. Added file: http://bugs.python.org/file9672/ast-r03.patch __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1810 __

[issue2290] [PATCH] Update Lib/distutils/sysconfig.py to handle x64 Windows builds living in pcbuild/amd64.

2008-03-15 Thread Trent Nelson
Trent Nelson [EMAIL PROTECTED] added the comment: Ah, I suspect not. (Unless the 64-bit python*.exe builds end up in pcbuild/amd64.) -- versions: -Python 2.5 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue2290

[issue2292] Missing *-unpacking generalizations

2008-03-15 Thread Thomas Wouters
New submission from Thomas Wouters [EMAIL PROTECTED]: The attached patch adds the missing *-unpacking generalizations. Specifically: a, b, *c = range(5) *a, b, c = a, b, *c a, b, c ([0, 1, 2], 3, 4) [ *a, b, c ] [0, 1, 2, 3, 4] L = [ a, (3, 4), {5}, {6: None}, (i for i in range(7, 10)) ]

[issue1158] %f format for datetime objects

2008-03-15 Thread Skip Montanaro
Skip Montanaro [EMAIL PROTECTED] added the comment: Checking this in. All tests pass. Have for quite awhile. rev 61402. -- assignee: - skip.montanaro __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1158 __

[issue2292] Missing *-unpacking generalizations

2008-03-15 Thread Alexander Belopolsky
Alexander Belopolsky [EMAIL PROTECTED] added the comment: This was discussed years ago and never got enough support: http://mail.python.org/pipermail/python-dev/2005-October/057177.html -- nosy: +belopolsky type: - feature request __ Tracker [EMAIL

[issue2292] Missing *-unpacking generalizations

2008-03-15 Thread Guido van Rossum
Guido van Rossum [EMAIL PROTECTED] added the comment: Didn't you say it does sets too? Does this work? a = [1, 2, 3] {1, *a, 0, 4} # {0, 1, 2, 3, 4} How about dicts? kwds = {'z': 0, 'w': 12} {'x': 1, 'y': 2, **kwds} # {'x': 1, 'y': 2, 'z': 0, 'w': 12} Also, now that we support [*a, b, c]

[issue2292] Missing *-unpacking generalizations

2008-03-15 Thread Thomas Wouters
Thomas Wouters [EMAIL PROTECTED] added the comment: On Sat, Mar 15, 2008 at 9:12 AM, Guido van Rossum [EMAIL PROTECTED] wrote: Guido van Rossum [EMAIL PROTECTED] added the comment: Didn't you say it does sets too? Does this work? a = [1, 2, 3] {1, *a, 0, 4} # {0, 1, 2, 3, 4} Yes.

[issue2292] Missing *-unpacking generalizations

2008-03-15 Thread Guido van Rossum
Guido van Rossum [EMAIL PROTECTED] added the comment: Looking at the flatten() example I'm curious -- how come the output of flatten(L) is displayed as a list rather than as generator at xx ? Also, do I understand correctly that yield *(1, 2, 3) is equivalent to yield 1 yield 2 yield

  1   2   >