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() argum

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 classn

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

2009-10-12 Thread Xavier Ho
Nadav, it's because reverse() modifies the list in-place. I've gotten this gotcha many times, If you had done: >>> a = [1,2,3,4] >>> a.reverse() >>> a [4, 3, 2, 1] Or even better: >>> a = [1,2,3,4][::-1] >>> a [4, 3, 2, 1] Cheers, Xav -- http://mail.python.org/mailman/listinfo/python-list

Re: An assessment of Tkinter and IDLE

2009-10-12 Thread r
On Oct 12, 12:43 am, TerryP wrote: > On Aug 27, 9:22 pm, r wrote: > > *Too many noobs start out with the "from Tkinter import *" idiom, > > 'import Tkinter as tk', that I like -- my fingers are lazier then the > mind ;). > > When I see the from whatever import *; I generally regard it in one of >

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 Brian J Mingus
Help on built-in function reverse: reverse(...) L.reverse() -- reverse *IN PLACE* On Mon, Oct 12, 2009 at 1:22 AM, Nadav Chernin wrote: > > > -- > http://mail.python.org/mailman/listinfo/python-list > > -- 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 && m...@alcyo

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

Anyone doing onc rpc?

2009-10-12 Thread rtwas
Hello, I need to write a stand-alone gui written in python to operate with an app written in C via rpc. I've managed to get an older version of the pynfs demo client and server to together. However, a client written in Python and a server written in "C", gen'd from the same *.x file don't see

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 timin

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 print ns_

Re: What do I do now?

2009-10-12 Thread Brendon Wickham
Speaking of itch, that's exactly the phrase Eric Steven Raymond uses for the same purpose in his famous essay: "Cathedral and the Bazaar" (http://www.catb.org/~esr/writings/cathedral-bazaar/). Someone Something, you should read this essay first, before anything else. Cheers, Brendon PS: I agree w

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

2009-10-12 Thread spazza
Enrico Franchi ha scritto: spazza 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 che tu di Python

Re: save windows clipboard content temporarily and restore later

2009-10-12 Thread kakarukeys
On Oct 10, 6:00 am, Neil Hodgson wrote: > 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

strange behaviour when inheriting from tuple

2009-10-12 Thread metal
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: def __init__(self, *args): print args Fo

Re: strange behaviour when inheriting from tuple

2009-10-12 Thread ryles
On Oct 11, 3:04 am, metal 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: >         def

postprocessing in os.walk

2009-10-12 Thread kj
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 handy fo

rfc: a self-editing script

2009-10-12 Thread gb345
The following fragment is from a tiny maintenance script that, among other things, edits itself, by rewriting the line that ends with '### REPLACE'. ## import re import fileinput LAST_VERSION = 'VERSION 155' ### REPLACE ser

Python CherryPy TurboGears 2 project support needed [in Belgium]

2009-10-12 Thread b...@creue-consulting
Dear comp.lang.python users, Firstly, this a is a Job post for a on-site Freelance Python Job in Belgium, I know this is frowned upon by some, so I am very sorry if it is not well received, but as it is such a great job, I have been encouraged to post this to the list. So, apology done, and hopef

Re: The rap against "while True:" loops

2009-10-12 Thread Peter Billam
On 2009-10-11, Bearophile wrote: > Peter Billam: >> I remember in the structured-programming revolution the >>    loop { ... if whatever {break;} ... } >> idiom was The Recommended looping structure, because the code is >> more maintainable. > > I think "break" was almost the antithesis of structu

Re: The rap against "while True:" loops

2009-10-12 Thread Bearophile
Peter Billam: > I remember in the structured-programming revolution the >    loop { ... if whatever {break;} ... } > idiom was The Recommended looping structure, because the code is > more maintainable. I think "break" was almost the antithesis of structured programming, it was seen as the little

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 no

Re: Plotting multiple datasets with gnuplot

2009-10-12 Thread Snorri H
On Oct 9, 1:36 pm, Rob Garrett 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 module are you us

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 b

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 resu

Re: The rap against "while True:" loops

2009-10-12 Thread greg
RDrewD wrote: my_prissy_little_indicator_variable = true while (my_prissy_little_indicator_variable){ } isn't satisfying because it doesn't guard the with any assurance that the loop invariant will be true before you enter into that block of code. The loop invariant and the exit conditio

Re: The rap against "while True:" loops

2009-10-12 Thread greg
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 condition is. Using a more meaningful name for the flag can help, but

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.so

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 contain

Re: An assessment of Tkinter and IDLE

2009-10-12 Thread TerryP
On Oct 12, 7:29 am, r 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. However the Tkin

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 += "?requestIds=[wisco.mPr

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 -- [1;36

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? >

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 Welcom

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 wa

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

2009-10-12 Thread Mark Dickinson
On Oct 12, 7:55 am, Helmut Jarausch 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 maybe(*choices): ret

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 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

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

2009-10-12 Thread Piet van Oostrum
> greg (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 WWW: http://pietvano

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 wrote: >> greg (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

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

2009-10-12 Thread Dave Angel
greg wrote: 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

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-lik

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 here...

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,

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. > personn

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 = copy.de

Re: The rap against "while True:" loops

2009-10-12 Thread Xavier Ho
On Mon, Oct 12, 2009 at 11:32 PM, Luis Zarrabeitia 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, X

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) W

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

2009-10-12 Thread MRAB
Piet van Oostrum wrote: greg (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. When is February 0? :-)

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

2009-10-12 Thread Mark Dickinson
On Oct 12, 7:55 am, Helmut Jarausch 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 problem: the --with-tsc conf

Re: An assessment of Tkinter and IDLE

2009-10-12 Thread Mel
Ben Finney wrote: > TerryP 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. Mel.

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 wo

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 pytho

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() br.select_form(nr=0)

Re: "Error en el bus" from python

2009-10-12 Thread Yusniel
On 12 oct, 00:08, Philip Semanchuk wrote: > On Oct 11, 2009, at 11:56 PM, Dennis Lee Bieber wrote: > > > On Sun, 11 Oct 2009 13:45:54 -0700 (PDT), Yusniel > > declaimed the following in gmane.comp.python.general: > > >>    prolog.consult("hanoi.pl") > >     > >> where "hanoy.pl" is a program with

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 s

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 wrote: On Oct 11, 2009, at 11:56 PM, Dennis Lee Bieber wrote: On Sun, 11 Oct 2009 13:45:54 -0700 (PDT), Yusniel declaimed the following in gmane.comp.python.general: prolog.consult("hanoi.pl") whe

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 imp

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 . > . > . >

Re: start external program from python

2009-10-12 Thread TerryP
On Oct 12, 10:15 am, 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 and the file hej.gb is a > textfile in the same directory. > Th

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: - d

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 som

Re: What do I do now?

2009-10-12 Thread Che M
On Oct 12, 12:19 am, Donn 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 questions amaze

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 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)

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 >

Re: AJAX Widget Framework

2009-10-12 Thread lkcl
On Oct 1, 6:01 pm, Laszlo Nagy 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 that is logged in

Re: The rap against "while True:" loops

2009-10-12 Thread Mensanator
On Oct 12, 3:36�am, greg 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 condition > is.

Re: some site login problem help plz..

2009-10-12 Thread lkcl
On Oct 5, 8:26 am, "Diez B. Roggisch" 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] On

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, Fe

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 > 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

Re: The rap against "while True:" loops

2009-10-12 Thread John Reid
Mensanator wrote: On Oct 12, 3:36�am, greg 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 condition is. Usin

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 """ ... Thread(target=MyClass().r

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

2009-10-12 Thread Buck
On Oct 10, 9:44 am, "Gabriel Genellina" 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 scripts, why not packages

Re: The rap against "while True:" loops

2009-10-12 Thread Ethan Furman
Mensanator wrote: On Oct 12, 3:36�am, greg 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 condition is. U

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) stuf

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 wrote: >>> greg (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

Re: The rap against "while True:" loops

2009-10-12 Thread Mensanator
On Oct 12, 1:02�pm, John Reid wrote: > Mensanator wrote: > > On Oct 12, 3:36 am, greg 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

Re: It Doesn't Add Up!

2009-10-12 Thread Chris Kaynor
Chris On Mon, Oct 12, 2009 at 11:33 AM, Victor Subervi wrote: > 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_' + str(i), '') > if

Re: It Doesn't Add Up!

2009-10-12 Thread Rami Chowdhury
On Mon, 12 Oct 2009 11:33:31 -0700, Victor Subervi 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 gives? You are sett

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 wrote: > 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

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 fo

Re: The rap against "while True:" loops

2009-10-12 Thread Falcolas
On Oct 12, 12:32 pm, Mensanator wrote: > On Oct 12, 1:02 pm, John Reid wrote: > > Mensanator wrote: > > > On Oct 12, 3:36 am, greg wrote: > > >> Mensanator wrote: > > >>> while not done: > > >>> ... > > >>> if n==1: done = True > > >>> ... > > >> Seems to me that 'while not done:' is no better t

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 sy

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

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 cod

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 -- http://mail.python.

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 __str__

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 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 A: >  de

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 recomme

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 ha

  1   2   >