[ANN] Leipzig Python User Group - Meeting, October 13, 2009, 08:00pm

2009-10-12 Thread Mike Müller
=== Leipzig Python User Group === We will meet on Tuesday, October 13 at 8:00 pm at the training center of Python Academy in Leipzig, Germany ( http://www.python-academy.com/center/find.html ). Food and soft drinks are provided. Please send a short confirmation mail to i...@python-academy.de,

ANN: next pyCologne meeting 14.10.2009 18:30 p.m.

2009-10-12 Thread Christopher Arndt
[German announcement, forwarded from pyCologne mailing list] Hallo liebe Pythonfreunde, das nächste Treffen von pyCologne, der Kölner Python-UserGroup, findet statt: Datum: Mittwoch, den 14.10.2009 Uhrzeit: 18:30 Uhr c.t. Ort: Pool 0.14, Benutzerrechenzentrum (RRZK-B) der

Docutils 0.6 released

2009-10-12 Thread grubert
Good morning, Release 0.6 is out. Changes are : * Two new writers for ODT and manpage (so there is no excuse for python software not having a manpage anymore). * Python2.2 is no longer supported. Release 0.6 is compatible with Python versions from 2.3 up to 2.6 and convertible to 3.1 code.

Python-3.2 (SVN) bug [was syntax question]

2009-10-12 Thread Helmut Jarausch
I wrote I'm trying to build the recent Python-3.2a (SVN). It fails in Lib/tokenize.py (line 87) 85 def group(*choices): return '(' + '|'.join(choices) + ')' 86 def any(*choices): return group(*choices) + '*' 87 def maybe(*choices): return group(*choices) + '?' with: TypeError: group()

a=[1,2,3,4].reverse() - why a is None?

2009-10-12 Thread Nadav Chernin
-- http://mail.python.org/mailman/listinfo/python-list

Re: Best way to handle changing list of class imports

2009-10-12 Thread greg
Dave Angel wrote: For that, I'd suggest reserving a directory at a known location, doing an os.path.dirname() on that directory, and building a list of module names. Then use __import__() to load them, and build a list of module objects, and a list of classes in those modules. Suggest

Re: a=[1,2,3,4].reverse() - why a is None?

2009-10-12 Thread Andre Engels
The reverse function is a function to reverse the list in place, not a function to get the reverse of the list: x = [1,2,3,4] y = x z = x.reverse() will result in: x = y = [4,3,2,1] z = None -- André Engels, andreeng...@gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: a=[1,2,3,4].reverse() - why a is None?

2009-10-12 Thread Erik Max Francis
Andre Engels wrote: The reverse function is a function to reverse the list in place, not a function to get the reverse of the list: x = [1,2,3,4] y = x z = x.reverse() will result in: x = y = [4,3,2,1] z = None .reverse returns None. See the documentation. -- Erik Max Francis

Re: a=[1,2,3,4].reverse() - why a is None?

2009-10-12 Thread Chris Withers
...becauase you were looking for: reversed([1,2,3,4]) Chris -- Simplistix - Content Management, Batch Processing Python Consulting - http://www.simplistix.co.uk -- http://mail.python.org/mailman/listinfo/python-list

SocketServer

2009-10-12 Thread Boris Arloff
This may not be the correct list for this issue, if so I would appreciate if anyone could forward it to the correct list.   I had experienced a number of problems with standard library SocketServer when implementing a tcp forking server under python 2.6.  I fixed every issue including some

Multiprocessing Fail

2009-10-12 Thread Terrence Cole
This code fails: ## from multiprocessing import Manager manager = Manager() ns_proxy = manager.Namespace() evt_proxy = manager.Event() ns_proxy.my_event_proxy = evt_proxy print ns_proxy.my_event_proxy ## Traceback (most recent call last): File test_nsproxy.py, line 39, in module

Re: Python vs Java - Perché i pythonisti ce l'hanno tanto con Java?

2009-10-12 Thread spazza
Enrico Franchi ha scritto: spazza spa...@alum.com wrote: ...snip... Non mi pare che al momento Python sia in grado di reggere tutto questo. Scusa, proseguendo in questa maniera andiamo pesantemente OT. Rimane pero' il problema di *dimostrare* la tua affermazione. Da quanto leggo, mi sembra

Re: strange behaviour when inheriting from tuple

2009-10-12 Thread ryles
On Oct 11, 3:04 am, metal metal...@gmail.com wrote: Environment: PythonWin 2.5.4 (r254:67916, Apr 27 2009, 15:41:14) [MSC v.1310 32 bit (Intel)] on win32. Portions Copyright 1994-2008 Mark Hammond - see 'Help/About PythonWin' for further copyright information. Evil Code: class Foo:      

Re: save windows clipboard content temporarily and restore later

2009-10-12 Thread Neil Hodgson
kakarukeys: I followed your hints, and wrote the following code. It works for most clipboard formats except files. Selecting and copying a file, followed by backup() and restore() throw an exception: For some formats the handle stored on the clipboard may not be a memory handle so may not

Re: Plotting multiple datasets with gnuplot

2009-10-12 Thread Snorri H
On Oct 9, 1:36 pm, Rob Garrett rgagarr...@gmail.com wrote: Hi, I'm trying to get gnuplot to display multiple data series on a single plot using gnuplot in python. I've searched around and haven't found a solution to how to do this when I have a variable-length list of plots to add. What

Re: The rap against while True: loops

2009-10-12 Thread greg
Steven D'Aprano wrote: Back in ancient days when dinosaurs walked the Earth, and I was programming in THINK Pascal on Apple Macintosh System 6, I'd go into nervous palpitations writing the equivalent of while True because if I got it wrong, I'd lock up the machine and need to hit the power

Re: Poll on Eval in Python

2009-10-12 Thread Kazimir Majorinc
On 10.10.2009 5:03, Kazimir Majorinc wrote: I am Lisp programmer and I write an article on issues as macros, fexprs and eval. I want to compare opinions of programmers of various programming languages on eval. If you want to contribute your opinion on eval in Python (or you want to look at

RE: a=[1,2,3,4].reverse() - why a is None?

2009-10-12 Thread Nadav Chernin
Chris Withers wrote: ...becauase you were looking for: reversed([1,2,3,4]) OK, but my question is generic. Why when I use object's function that changed values of the object, I can't to get value of it on the fly without writing additional code? a=[1,3,2,4] a.sort()

Daemon call python program

2009-10-12 Thread ���m�ۤv...@����
I have a daemon process which will call a python program. What do I do if I want to dump the exception when the python program exist by uncaught exception. Thanks a lot! -- ※Post by command from 59-124-255-226.HINET-IP.

Re: The rap against while True: loops

2009-10-12 Thread greg
kj wrote: I'm coaching a group of biologists on basic Python scripting. One of my charges mentioned that he had come across the advice never to use loops beginning with while True. It's possible this is something he was told in relation to another language that has more options. For example,

Re: code in a module is executed twice (cyclic import problems) ?

2009-10-12 Thread greg
Dave Angel wrote: The point you should get from that link is Don't do circular imports. Ever. No, I would say the lesson to be learned from this is don't use the same file as both a main script and an imported module. I would create another file called e.g. 'main.py' that simply contains

Re: An assessment of Tkinter and IDLE

2009-10-12 Thread TerryP
On Oct 12, 7:29 am, r rt8...@gmail.com wrote: Obviously you have never used packages that are meant for global importing or you would know how such systems are designed. OpenGL is a good example. OpenGL has over 3600 functions and constants all of which start with gl and GL respectivly.

How to transfer a string from cgi at server side to a javascript function at client side as an argument?

2009-10-12 Thread zxo102
Hi everyone, How can I transfer a string from a cgi at server side to a javascript function at client side as an argument? Here is my case: 1. client side: javascript in html page: ... mygrid = new dhtmlXGridObject('gridbox'); ... var cgi3 = /bop-cgi/xbop; cgi3 +=

Re: Daemon call python program

2009-10-12 Thread ���m�ۤv...@����
※ 引述《command (找尋自己的一片天)》之銘言: : I have a daemon process which will call a python program. : What do I do if I want to dump the exception when the python program exist : by uncaught exception. : Thanks a lot! By the way, the python program is multi-thread -- ※Post by command

Re: mxDateTime history (Re: mktime, how to handle dates before 01-01-1970 ?)

2009-10-12 Thread greg
MRAB wrote: And when someone says January 30, do they really mean the day before the last day of the month? No, no, that's January -2, a *completely* different thing! -- Greg -- http://mail.python.org/mailman/listinfo/python-list

RE: a=[1,2,3,4].reverse() - why a is None?

2009-10-12 Thread Diez B. Roggisch
Nadav Chernin wrote: Chris Withers wrote: ...becauase you were looking for: reversed([1,2,3,4]) OK, but my question is generic. Why when I use object's function that changed values of the object, I can't to get value of it on the fly without writing additional code? a=[1,3,2,4]

Re: New hire

2009-10-12 Thread Jean-Michel Pichavant
Emeka wrote: Hello All, I am new to python , and my aim is to use it to write sugar-based applications on XO(OLPC). I am not new to programming in general, I would want to know the best route to take in learning python. I have background in FP and Imperative languages. Regards, Emeka

start external program from python

2009-10-12 Thread Bjorn
Hi, I woul like to start a program from within python (under linux): This works fine: import os path = 'tclsh AppMain.tcl hej.gb' os.system(path) The file AppMain.tcl is the executable and the file hej.gb is a textfile in the same directory. The text file gets opened in the app in the correct

Re: Python-3.2 (SVN) bug [was syntax question]

2009-10-12 Thread Mark Dickinson
On Oct 12, 7:55 am, Helmut Jarausch jarau...@igpm.rwth-aachen.de wrote: I wrote I'm trying to build the recent Python-3.2a (SVN). It fails in Lib/tokenize.py  (line 87) 85  def group(*choices): return '(' + '|'.join(choices) + ')' 86  def any(*choices): return group(*choices) + '*' 87  def

Re: a=[1,2,3,4].reverse() - why a is None?

2009-10-12 Thread Andre Engels
On Mon, Oct 12, 2009 at 10:44 AM, Nadav Chernin nada...@qualisystems.com wrote:        Chris Withers wrote:        ...becauase you were looking for:        reversed([1,2,3,4]) OK, but my question is generic. Why when I use object's function that changed values of the object, I can't to

Re: mxDateTime history (Re: mktime, how to handle dates before 01-01-1970 ?)

2009-10-12 Thread Piet van Oostrum
greg g...@cosc.canterbury.ac.nz (g) wrote: g MRAB wrote: And when someone says January 30, do they really mean the day before the last day of the month? g No, no, that's January -2, a *completely* different thing! But for someone else it would be February -2. -- Piet van Oostrum

Re: postprocessing in os.walk

2009-10-12 Thread Dave Angel
kj wrote: Perl's directory tree traversal facility is provided by the function find of the File::Find module. This function accepts an optional callback, called postprocess, that gets invoked just before leaving the currently processed directory. The documentation goes on to say This hook is

Re: mxDateTime history (Re: mktime, how to handle dates before 01-01-1970 ?)

2009-10-12 Thread Chris Rebert
On Mon, Oct 12, 2009 at 4:27 AM, Piet van Oostrum p...@cs.uu.nl wrote: greg g...@cosc.canterbury.ac.nz (g) wrote: g MRAB wrote: And when someone says January 30, do they really mean the day before the last day of the month? g No, no, that's January -2, a *completely* different thing! But

Re: code in a module is executed twice (cyclic import problems) ?

2009-10-12 Thread Dave Angel
greg wrote: div class=moz-text-flowed style=font-family: -moz-fixedDave Angel wrote: The point you should get from that link is Don't do circular imports. Ever. No, I would say the lesson to be learned from this is don't use the same file as both a main script and an imported module. I

Re: Why ELIF?

2009-10-12 Thread Esmail
TerryP wrote: Somehow I doubt that Look up X in dictionary D could ever be more efficient (in terms of space and time, at least) then Check if X is equal to Y. It's not about what you get in runtime but what you get in monkey time. Most expressions that would make someone reach for a C-like

deepcopy of class inherited from Thread

2009-10-12 Thread VYAS ASHISH M-NTB837
Dear All I am running this piece of code: from threading import Thread import copy class Ashish(Thread): def __init__(self, i): Thread.__init__(self) self.foo = i def run(self): print (self, self.foo) d= Ashish(4) e = copy.deepcopy(d) --- Exception

Re: The rap against while True: loops

2009-10-12 Thread Luis Zarrabeitia
On Sunday 11 October 2009 11:56:55 pm Dennis Lee Bieber wrote: In this situation, the middle exit works best -- using non-optimal Python while True: lin = file_object.readline() if not lin: break do something with lin Actually, in

Re: best vi / emacs python features

2009-10-12 Thread Jorgen Grahn
On Wed, 2009-10-07, OdarR wrote: hello, * this is not a troll * which kind of help you have with your favorite editor ? Syntax highlighting and help with the indentation (move to the right after an else:, keep in the same column normally, etc). Nothing else specific to Python. personnally,

Re: deepcopy of class inherited from Thread

2009-10-12 Thread Dave Angel
VYAS ASHISH M-NTB837 wrote: Dear All I am running this piece of code: from threading import Thread import copy class Ashish(Thread): def __init__(self, i): Thread.__init__(self) self.foo = i def run(self): print (self, self.foo) d= Ashish(4) e =

Re: The rap against while True: loops

2009-10-12 Thread Xavier Ho
On Mon, Oct 12, 2009 at 11:32 PM, Luis Zarrabeitia ky...@uh.cu wrote: Actually, in python, this works even better: for lin in iter(file_object.readline, ): ... do something with lin What about with open(path_string) as f: for line in f: # do something Cheers, Xav --

Re: What do I do now?

2009-10-12 Thread exarkun
On 11 Oct, 10:53 pm, fordhai...@gmail.com wrote: I've been programming since about 3 years, and come to think of it never written anything large. I know a few languages: c, python, perl, java. Right now, I just write little IRC bots that basically don't do anything. I have two questions: 1)

Re: mxDateTime history (Re: mktime, how to handle dates before 01-01-1970 ?)

2009-10-12 Thread MRAB
Piet van Oostrum wrote: greg g...@cosc.canterbury.ac.nz (g) wrote: g MRAB wrote: And when someone says January 30, do they really mean the day before the last day of the month? g No, no, that's January -2, a *completely* different thing! But for someone else it would be February -2.

Re: Python-3.2 (SVN) bug [was syntax question]

2009-10-12 Thread Mark Dickinson
On Oct 12, 7:55 am, Helmut Jarausch jarau...@igpm.rwth-aachen.de wrote: I wrote I'm trying to build the recent Python-3.2a (SVN). It fails in Lib/tokenize.py  (line 87) [...] with: TypeError: group() argument after ** must be a mapping, not tuple I believe I've found the source of this

Re: An assessment of Tkinter and IDLE

2009-10-12 Thread Mel
Ben Finney wrote: TerryP bigboss1...@gmail.com writes: One thing you should also learn about me, is I do not deal in absolutes. What, *never*? That's a pretty uncompromising position to h— I'll get my coat. Note, he said he does not deal in absolutes. He didn't deny that he does.

Re: The rap against while True: loops

2009-10-12 Thread Mel
Luis Zarrabeitia wrote: On Sunday 11 October 2009 11:56:55 pm Dennis Lee Bieber wrote: In this situation, the middle exit works best -- using non-optimal Python while True: lin = file_object.readline() if not lin: break do something with lin Actually, in python, this works even better:

pickle's backward compatibility

2009-10-12 Thread Peng Yu
Hi, If I define my own class and use pickle to serialize the objects in this class, will the serialized object be successfully read in later version of python. What if I serialize (using pickle) an object of a class defined in python library, will it be successfully read in later version of

POST value related question

2009-10-12 Thread james27
hello im using mechanize . i want to send some post value by use mechanize. but problem is one of POST value in html source is looks like below. post.category.categoryNo=[*1] anyway so i was tried several method but all failed. here is source . . . br = mechanize.browser()

Re: Error en el bus from python

2009-10-12 Thread Yusniel
On 12 oct, 00:08, Philip Semanchuk phi...@semanchuk.com wrote: On Oct 11, 2009, at 11:56 PM, Dennis Lee Bieber wrote: On Sun, 11 Oct 2009 13:45:54 -0700 (PDT), Yusniel yhidalg...@gmail.com declaimed the following in gmane.comp.python.general:    prolog.consult(hanoi.pl)    snip where

Re: pickle's backward compatibility

2009-10-12 Thread exarkun
On 03:17 pm, pengyu...@gmail.com wrote: Hi, If I define my own class and use pickle to serialize the objects in this class, will the serialized object be successfully read in later version of python. What if I serialize (using pickle) an object of a class defined in python library, will it be

Re: Error en el bus from python

2009-10-12 Thread Philip Semanchuk
On Oct 12, 2009, at 11:27 AM, Yusniel wrote: On 12 oct, 00:08, Philip Semanchuk phi...@semanchuk.com wrote: On Oct 11, 2009, at 11:56 PM, Dennis Lee Bieber wrote: On Sun, 11 Oct 2009 13:45:54 -0700 (PDT), Yusniel yhidalg...@gmail.com declaimed the following in gmane.comp.python.general:

Re: Error en el bus from python

2009-10-12 Thread Carsten Haese
Yusniel wrote: Exactly. hanoi.pl is a prolog program. I'm using Ubuntu(9.04) 32 bit. In this case, this error is generated when I try run the above script. However, others scripts in python, not throws this error, I think that there are some problem with this library. Maybe, but it's

Re: POST value related question

2009-10-12 Thread Diez B. Roggisch
james27 wrote: hello im using mechanize . i want to send some post value by use mechanize. but problem is one of POST value in html source is looks like below. post.category.categoryNo=[*1] anyway so i was tried several method but all failed. here is source . . . br =

Re: start external program from python

2009-10-12 Thread TerryP
On Oct 12, 10:15 am, Bjorn bjornj...@gmail.com wrote: Hi, I woul like to start a program from within python (under linux): This works fine: import os path = 'tclsh AppMain.tcl hej.gb' os.system(path) The file AppMain.tcl is the executable and the file hej.gb is a textfile in the same

Looking for a buffered/windowed iterator

2009-10-12 Thread samwyse
I have Python program that lets me interact with a bunch of files. Unfortunately, the program assumes that the bunch is fairly small, and I have thousands of files on relatively slow storage. Just creating a list of the file names takes several minutes, so I'm planning to replace the list with an

RE: deepcopy of class inherited from Thread

2009-10-12 Thread VYAS ASHISH M-NTB837
Hi I have an object which has a run() method. But I can call it only once. Calling the start() again will give RuntimeError: thread already started So what is the way to do this? I thought of doing a deep copy of the object, as shallow copy will also lead to the above error. I tried this: -

Re: Looking for a buffered/windowed iterator

2009-10-12 Thread Robert Kern
On 2009-10-12 11:21 AM, samwyse wrote: Previous discussions in c.l.py (primarily those that propose new functions to be added to itertools) claim that people do this all the time, but seem woefully short of actual examples. Before I possibly re-invent the wheel(*), could someone point me to

Re: What do I do now?

2009-10-12 Thread Che M
On Oct 12, 12:19 am, Donn donn.in...@gmail.com wrote: On Monday 12 October 2009 00:53:42 Someone Something wrote: 1) What should I start programming (project that takes 1-2 months, not very short term)? 2) Whtat are some good open source projects I can start coding for? These kinds of

Re: The rap against while True: loops

2009-10-12 Thread Luis Zarrabeitia
On Monday 12 October 2009 09:47:23 am Xavier Ho wrote: On Mon, Oct 12, 2009 at 11:32 PM, Luis Zarrabeitia ky...@uh.cu wrote: Actually, in python, this works even better: for lin in iter(file_object.readline, ): ... do something with lin What about with open(path_string) as f:

Re: What do I do now?

2009-10-12 Thread Tim Chase
Che M wrote: 2. Start your own. As long it is not another new code editor for Python. There are a lot already. How about writing a web framework instead? [grins ducks] -tkc -- http://mail.python.org/mailman/listinfo/python-list

how to move a webiste in python

2009-10-12 Thread Bhanu Mangipudi
Hi, I am new to python I have few questions regarding it. I have to me a website with python scripts from one server to another server , when I moved the content the website is not working, do I have to recompile the code in new server too. Can any help me to resolve this issue ?? Thanks Bhanu

Re: deepcopy of class inherited from Thread

2009-10-12 Thread Mick Krippendorf
VYAS ASHISH M-NTB837 schrieb: I have an object which has a run() method. But I can call it only once. Calling the start() again will give RuntimeError: thread already started So what is the way to do this? I thought of doing a deep copy of the object, as shallow copy will also lead to

Re: AJAX Widget Framework

2009-10-12 Thread lkcl
On Oct 1, 6:01 pm, Laszlo Nagy gand...@shopzeus.com wrote: I'm looking for an open source, AJAX based widget/windowing framework. Here is what I need: - end user opens up a browser, points it to a URL, logs in - on the server site, sits my application, creating a new session for each user

Re: The rap against while True: loops

2009-10-12 Thread Mensanator
On Oct 12, 3:36�am, greg g...@cosc.canterbury.ac.nz wrote: Mensanator wrote: while not done: � � ... � � if n==1: done = True � � ... Seems to me that 'while not done:' is no better than 'while True:', because in both cases you have to look inside the loop to find out what the exit

Re: some site login problem help plz..

2009-10-12 Thread lkcl
On Oct 5, 8:26 am, Diez B. Roggisch de...@nospam.web.de wrote: james27 wrote: hello.. im new to python. i have some problem with mechanize. before i was used mechanize with no problem. but i couldn't success login with some site. for several days i was looked for solution but failed.

RE: deepcopy of class inherited from Thread

2009-10-12 Thread VYAS ASHISH M-NTB837
The function that I want to run is part of a class, not a standalone function. There are several class member variables also. Regards, Ashish Vyas -Original Message- From: python-list-bounces+ntb837=motorola@python.org [mailto:python-list-bounces+ntb837=motorola@python.org]

Re: mxDateTime history (Re: mktime, how to handle dates before 01-01-1970 ?)

2009-10-12 Thread M.-A. Lemburg
Tim Chase wrote: Month arithmetic is a bit of a mess, since it's not clear how to map e.g. Jan 31 + one month. Jan 31 + one month usually means add one to the month value and then keep backing off the day if you get an exception making the date, so you'd get Feb 31, exception, Feb 30,

Re: mxDateTime history (Re: mktime, how to handle dates before 01-01-1970 ?)

2009-10-12 Thread M.-A. Lemburg
Rhodri James wrote: On Fri, 09 Oct 2009 13:39:43 +0100, Tim Chase python.l...@tim.thechases.com wrote: Month arithmetic is a bit of a mess, since it's not clear how to map e.g. Jan 31 + one month. Jan 31 + one month usually means add one to the month value and then keep backing off the

Re: The rap against while True: loops

2009-10-12 Thread John Reid
Mensanator wrote: On Oct 12, 3:36�am, greg g...@cosc.canterbury.ac.nz wrote: Mensanator wrote: while not done: � � ... � � if n==1: done = True � � ... Seems to me that 'while not done:' is no better than 'while True:', because in both cases you have to look inside the loop to find out what

Re: deepcopy of class inherited from Thread

2009-10-12 Thread Mick Krippendorf
VYAS ASHISH M-NTB837 schrieb: The function that I want to run is part of a class, not a standalone function. There are several class member variables also. Then try: class MyClass(object): ... def run(self): do threaded stuff here ...

Re: organizing your scripts, with plenty of re-use

2009-10-12 Thread Buck
On Oct 10, 9:44 am, Gabriel Genellina gagsl-...@yahoo.com.ar wrote: The good thing is that, if the backend package is properly installed   somewhere in the Python path ... it still works with no modifications. I'd like to get to zero-installation if possible. It's easy with simple python

Re: The rap against while True: loops

2009-10-12 Thread Ethan Furman
Mensanator wrote: On Oct 12, 3:36�am, greg g...@cosc.canterbury.ac.nz wrote: Mensanator wrote: while not done: � � ... � � if n==1: done = True � � ... Seems to me that 'while not done:' is no better than 'while True:', because in both cases you have to look inside the loop to find out

It Doesn't Add Up!

2009-10-12 Thread Victor Subervi
Hi; I have the following code: for row in data: i += 1 total = 0 quantity = form.getfirst('order_' + str(i), '') if quantity != '': sql = 'select * from products p join %s c on p.ID=c.ID where c.ID=%s;' % (client, str(i)) cursor.execute(sql)

Re: mxDateTime history (Re: mktime, how to handle dates before 01-01-1970 ?)

2009-10-12 Thread M.-A. Lemburg
Chris Rebert wrote: On Mon, Oct 12, 2009 at 4:27 AM, Piet van Oostrum p...@cs.uu.nl wrote: greg g...@cosc.canterbury.ac.nz (g) wrote: g MRAB wrote: And when someone says January 30, do they really mean the day before the last day of the month? g No, no, that's January -2, a *completely*

Re: The rap against while True: loops

2009-10-12 Thread Mensanator
On Oct 12, 1:02�pm, John Reid j.r...@mail.cryst.bbk.ac.uk wrote: Mensanator wrote: On Oct 12, 3:36 am, greg g...@cosc.canterbury.ac.nz wrote: Mensanator wrote: while not done: ... if n==1: done = True ... Seems to me that 'while not done:' is no better than 'while True:', because

Re: It Doesn't Add Up!

2009-10-12 Thread Chris Kaynor
Chris On Mon, Oct 12, 2009 at 11:33 AM, Victor Subervi victorsube...@gmail.comwrote: Hi; I have the following code: for row in data: i += 1 total = 0 In the above line, you're setting total to 0 each time the loop runs. quantity = form.getfirst('order_' +

Re: It Doesn't Add Up!

2009-10-12 Thread Rami Chowdhury
On Mon, 12 Oct 2009 11:33:31 -0700, Victor Subervi victorsube...@gmail.com wrote: Hi; I have the following code: for row in data: i += 1 total = 0 [snip] As you can see, the total doesn't accumulate! There are two rows. The second Total 1: should show 1.98, not 0! What

Re: It Doesn't Add Up!

2009-10-12 Thread Victor Subervi
Ouch! You're right! ;) V On Mon, Oct 12, 2009 at 1:38 PM, Rami Chowdhury rami.chowdh...@gmail.comwrote: On Mon, 12 Oct 2009 11:33:31 -0700, Victor Subervi victorsube...@gmail.com wrote: Hi; I have the following code: for row in data: i += 1 total = 0 [snip] As you

Re: It Doesn't Add Up!

2009-10-12 Thread MRAB
Victor Subervi wrote: Hi; I have the following code: [snip] price = str(int(stuff[5]*100)) price = price[0:len(price)-2] + '.' + price[-2:] [snip] This is simpler: price = %.2f % stuff[5] (not that I like what you're doing with it; leaving it as a float and just

Re: The rap against while True: loops

2009-10-12 Thread Falcolas
On Oct 12, 12:32 pm, Mensanator mensana...@aol.com wrote: On Oct 12, 1:02 pm, John Reid j.r...@mail.cryst.bbk.ac.uk wrote: Mensanator wrote: On Oct 12, 3:36 am, greg g...@cosc.canterbury.ac.nz wrote: Mensanator wrote: while not done: ... if n==1: done = True ... Seems to me

Hello python users

2009-10-12 Thread Spencer Heckathorn
Hi, I am new to this list. I have some goals in mind but I am unsure of where to start. I want to connect to my gmail account, find specific emails and save the contents of the emails to a txt file. I would like to open none txt files (.nc files) which can be opened in note pad and saved as a txt.

Re: start external program from python

2009-10-12 Thread Jorgen Grahn
On Mon, 2009-10-12, Bjorn wrote: Hi, I woul like to start a program from within python (under linux): This works fine: import os path = 'tclsh AppMain.tcl hej.gb' os.system(path) The file AppMain.tcl is the executable Not really -- tclsh is the executable from Python's and the system's

which dictionary with attribute-style access?

2009-10-12 Thread Andreas Balogh
Hello, googling I found several ways of implementing a dictionary with attribute-style access. 1. ActiveState cookbook: http://code.activestate.com/recipes/473786/ 2. ActiveState cookbook: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/361668 3. web2py codebase: Storage(dict) I

Re: Daemon call python program

2009-10-12 Thread Jorgen Grahn
On Mon, 2009-10-12, §ä´m¦Û¤vª�...@¤ù¤Ñ wrote: ?? ???z?mcommand (???m???v...@)?n???G : I have a daemon process which will call a python program. : What do I do if I want to dump the exception when the python program exist : by uncaught exception. : Thanks a lot! By the way, the

Re: Error en el bus from python

2009-10-12 Thread Jorgen Grahn
On Mon, 2009-10-12, Philip Semanchuk wrote: On Oct 11, 2009, at 4:45 PM, Yusniel wrote: Hi. I did installed a library for python named pyswip-0.2.2 but when I run a python example with the next lines, the python interpreter, it throw me the following error: Error en el bus. The code lines

Re: best vi / emacs python features

2009-10-12 Thread Gabor Urban
Hey guys, this is supposed to be a Python mailing list... Both editors are great and are with great potentials. I do use both of them daily, though for different purposes. It is meaningless to start this old issue of preferences anew. -- Linux: Choice of a GNU Generation --

What is the correct way to define __hash__?

2009-10-12 Thread Peng Yu
Hi, I'm wondering what is the general way to define __hash__. I could add up all the members. But I am wondering if this would cause a performance issue for certain classes. Regards, Peng #!/usr/bin/env python class A: def __init__(self, a, b) : self._a = a self._b = b def

Re: What is the correct way to define __hash__?

2009-10-12 Thread Peng Yu
On Mon, Oct 12, 2009 at 3:45 PM, Peng Yu pengyu...@gmail.com wrote: Hi, I'm wondering what is the general way to define __hash__. I could add up all the members. But I am wondering if this would cause a performance issue for certain classes. Regards, Peng #!/usr/bin/env python class

Re: What is the correct way to define __hash__?

2009-10-12 Thread Robert Kern
On 2009-10-12 15:45 PM, Peng Yu wrote: Hi, I'm wondering what is the general way to define __hash__. I could add up all the members. But I am wondering if this would cause a performance issue for certain classes. Unless if you are very familiar with the math of hash functions, I don't

Re: What is the correct way to define __hash__?

2009-10-12 Thread Christian Heimes
Peng Yu schrieb: Hi, I'm wondering what is the general way to define __hash__. I could add up all the members. But I am wondering if this would cause a performance issue for certain classes. def __hash__(self): return self._a + self._b The hash of a tuple is based on the hash of

Re: The rap against while True: loops

2009-10-12 Thread Mensanator
On Oct 12, 2:18 pm, Falcolas garri...@gmail.com wrote: On Oct 12, 12:32 pm, Mensanator mensana...@aol.com wrote: On Oct 12, 1:02 pm, John Reid j.r...@mail.cryst.bbk.ac.uk wrote: Mensanator wrote: On Oct 12, 3:36 am, greg g...@cosc.canterbury.ac.nz wrote: Mensanator wrote:

POST value related question

2009-10-12 Thread ken
hello i have some problem to send POST value by use mechanize. i can't write my article to my blog site. here is full source. and what i want to do is, im posting my article to my blog site. thanks in advance. # -*- coding: cp949 -*- import mechanize import cookielib # Browser br =

Work around metaclass programming

2009-10-12 Thread Zac Burns
I have a class called Signal which is a descriptor. It is a descriptor so that it can create BoundSignals, much like the way methods work. What I would like to do is to have the class be a descriptor when instantiated in what will be the locals of the class, but not a descriptor everywhere else.

Re: windows side-by-side configuration woes on windows HPC

2009-10-12 Thread Nick Touran
It is indeed a pain. I would really like a work-around. Matplotlib is supposed to be immune to this nowadays but it's not. Nor are some other third-party modules. Did they break with the new release? (2.6.3?) -nick On Thu, Oct 8, 2009 at 1:12 PM, M.-A. Lemburg m...@egenix.com wrote: Nick Touran

Re: which dictionary with attribute-style access?

2009-10-12 Thread Rhodri James
On Mon, 12 Oct 2009 20:58:35 +0100, Andreas Balogh balo...@gmail.com wrote: Hello, googling I found several ways of implementing a dictionary with attribute-style access. 1. ActiveState cookbook: http://code.activestate.com/recipes/473786/ 2. ActiveState cookbook:

Re: windows side-by-side configuration woes on windows HPC

2009-10-12 Thread M.-A. Lemburg
Nick Touran wrote: It is indeed a pain. I would really like a work-around. Matplotlib is supposed to be immune to this nowadays but it's not. Nor are some other third-party modules. Did they break with the new release? (2.6.3?) The main problem appears to be that the the MS VC9 compiler

Re: organizing your scripts, with plenty of re-use

2009-10-12 Thread Carl Banks
On Oct 12, 11:24 am, Buck workithar...@gmail.com wrote: On Oct 10, 9:44 am, Gabriel Genellina gagsl-...@yahoo.com.ar wrote: The good thing is that, if the backend package is properly installed   somewhere in the Python path ... it still works with no modifications. I'd like to get to

In python CGI, how to pass hello back to a javascript function as an argument at client side?

2009-10-12 Thread zxo102
Hi everyone, How can I pass a string generated from python cgi at server side to a javascript function as an argument at client side? Here is my case: 1. client side: load is a javascript function in a html page. It starts the python CGI test.py via Apache: html script

Re: organizing your scripts, with plenty of re-use

2009-10-12 Thread Ethan Furman
Stef Mientki wrote: Gabriel Genellina wrote: [snip] That's what I meant to say. It IS a zero-installation schema, and it also works if you properly install the package. Quoting Steven D'Aprano (changing names slightly): You would benefit greatly from separating the interface from the

Re: Error en el bus from python

2009-10-12 Thread greg
Jorgen Grahn wrote: Bus Error is an old BSD-ism which I guess you don't see much in Linux or Solaris these days (or maybe I never run buggy code ;-). It translates roughly to segmentation fault, but IIRC it is more about accessing memory words on nonaligned adresses than about accessing

Re: pickle's backward compatibility

2009-10-12 Thread Gabriel Genellina
En Mon, 12 Oct 2009 12:17:52 -0300, Peng Yu pengyu...@gmail.com escribió: If I define my own class and use pickle to serialize the objects in this class, will the serialized object be successfully read in later version of python. From http://docs.python.org/library/pickle.html: The pickle

  1   2   >