Re: Tkinter and exceptions

2006-07-25 Thread Peter Otten
Nick Craig-Wood wrote: > I'm just starting out with Tkinter programming (using Programming > Python as a reference), and I couldn't find the answer to this > anywhere... > > How do you catch general exceptions in a Tkinter program. If you run > the below and click the "Exception" or "Callback Ex

Re: doctest with variable return value

2006-07-25 Thread 3KWA
Peter Otten wrote: > You cannot test for an unknown value, but you can do some sanity checks: > > >>> rate = get_rate('AUDEUR') > >>> rate > 0 > True > >>> isinstance(rate, float) > True > > This will at least make sure that get_rate() does not throw an exception. Thanks a lo

webbrowser open failing

2006-07-25 Thread Thomas
Hi all, I am getting an error using webbrowser open on mac 10.3 using python 2.3.5 >>> test=open("/Volumes/TINTZ;P3/DT Hot Folder test/Justin_Test.pDF","r") >>> type(test) >>> webbrowser.open("/Volumes/TINTZ;P3/DT Hot Folder test/Justin_Test.pDF","r") Traceback (most recent call last):

Tkinter and exceptions

2006-07-25 Thread Nick Craig-Wood
I'm just starting out with Tkinter programming (using Programming Python as a reference), and I couldn't find the answer to this anywhere... How do you catch general exceptions in a Tkinter program. If you run the below and click the "Exception" or "Callback Exception" buttons you see a traceback

Re: 2 timers, doesnt work?

2006-07-25 Thread Frank Millman
Kiran wrote: > I am creating 2 timers inside a GUI, but it seems that only the one > declared last (the second timer), gets triggered, but the first one > doesnt. > You really should check the archives before posting. Exactly the same question was asked less than a week ago. The original questio

Re: Help in string.digits functions

2006-07-25 Thread Anoop
Hi All Thankyou verymuch for ur inputs. Hope u might have come across the string deprecation thought of in Python 3.0 as a result of which we need to use all of these as some objects For example : string.lower(str) needs to be some thing like str.lower(). Can u tell me whether such a change in

Re: list problem

2006-07-25 Thread Simon Forman
placid wrote: > Simon Forman wrote: > > placid wrote: > > > Hi all, > > > > > > I have two lists that contain strings in the form string + number for > > > example > > > > > > >>> list1 = [ ' XXX1', 'XXX2', 'XXX3', 'XXX5'] > > > > > > the second list contains strings that are identical to the first

Re: Newbie Q: Class Privacy (or lack of)

2006-07-25 Thread Steve Jobless
Steve Jobless wrote: > > Hi, > > I just started learning Python. I went through most of the tutorial at > python.org. But I noticed something weird. I'm not talking about the > __private hack. > > Let's say the class is defined as: > > class MyClass: > def __init__(self): > pass >

Re: list problem

2006-07-25 Thread placid
Simon Forman wrote: > placid wrote: > > Hi all, > > > > I have two lists that contain strings in the form string + number for > > example > > > > >>> list1 = [ ' XXX1', 'XXX2', 'XXX3', 'XXX5'] > > > > the second list contains strings that are identical to the first list, > > so lets say the second

Re: list problem

2006-07-25 Thread Simon Forman
Simon Forman wrote: > Finally, you can say: > > for i in xrange(1,10): > s = "XXX1%04i" % i > if s not in list1 and s not in list2: > print s > > HTH, > ~Simon D'oh! Forgot to break. for i in xrange(1,10): s = "XXX1%04i" % i if s not in list1 and s not in list2: p

Re: list problem

2006-07-25 Thread Simon Forman
placid wrote: > Hi all, > > I have two lists that contain strings in the form string + number for > example > > >>> list1 = [ ' XXX1', 'XXX2', 'XXX3', 'XXX5'] > > the second list contains strings that are identical to the first list, > so lets say the second list contains the following > > >>> list

Re: Need a compelling argument to use Django instead of Rails

2006-07-25 Thread Michele Simionato
Joe Knapka ha scritto: > Classes are effectively open in Python, too, at least > where methods are concerned, since one can do > klass.__dict__["myMethod"]=myMethod. Yes, but builtin classes in Python are closed and this is the relevant point. Michele Simionato -- http://mail

Re: building an index for large text files for fast access

2006-07-25 Thread Simon Forman
Yi Xing wrote: > Hi, > > I need to read specific lines of huge text files. Each time, I know > exactly which line(s) I want to read. readlines() or readline() in a > loop is just too slow. Since different lines have different size, I > cannot use seek(). So I am thinking of building an index for th

list problem

2006-07-25 Thread placid
Hi all, I have two lists that contain strings in the form string + number for example >>> list1 = [ ' XXX1', 'XXX2', 'XXX3', 'XXX5'] the second list contains strings that are identical to the first list, so lets say the second list contains the following >>> list1 = [ ' XXX1', 'XXX2', 'XXX3', '

Re: Dive Into Python -- Still Being Updated?

2006-07-25 Thread hanumizzle
Alan Franzoni wrote: > Il 22 Jul 2006 15:48:36 -0700, [EMAIL PROTECTED] ha scritto: > > > http://diveintopython.org/getting_to_know_python/indenting_code.html > > > > The function called fib (presumably short for Fibonacci) appears to > > produce factorials. Anyway, 'fib' should really be called '

Re: building an index for large text files for fast access

2006-07-25 Thread alex23
Erik Max Francis wrote: > I believe the module you're referring to is `linecache`. Thanks, Erik. That's what I get for posting on my way out of work :) -alex23 -- http://mail.python.org/mailman/listinfo/python-list

Re: Package organization

2006-07-25 Thread Mike Wyatt
You read me like a book :)  I just moved from C# a few months ago, and I played with C++ for a while before that. Seriously though, for some of my more complicated subsystems (graphics, for example), putting all the classes in one module seems excessive.  Right now that subsystem has around 10

Re: How to force a thread to stop

2006-07-25 Thread bryanjugglercryptographer
Carl J. Van Arsdall wrote: > Unfortunately this is due to the nature of the problem I am tasked with > solving. I have a large computing farm, these os.system calls are often > things like ssh that do work on locations remote from the initial python > task. I suppose eventually I'll end up using

Re: Missing rotor module

2006-07-25 Thread Paul Rubin
"Nick Vatamaniuc" <[EMAIL PROTECTED]> writes: > Unfortunately rotor has been deprecated but it hasn't been replaced > with anything reasonable as far as encryption goes -- there are just a > bunch of hashing funtions (sha, md5) only. If you need to replace rotor > all together I would sugest the cr

Re: Need a compelling argument to use Django instead of Rails

2006-07-25 Thread Damjan
> A few months ago I had to choose between RoR and a Python framework > (TurboGears in that case). I picked TurboGears because of the language > maturity and all the third party libs. i.e. I can do PDF reporting with > reportLab, control OpenOffice with Python.. This is a good argument, you should

Re: 3d simulation

2006-07-25 Thread alimoe
placid wrote: > is this a real robot or a computer simulation? Just a sim, but the more I think about it, the more realism it seems like I need. Carl Banks wrote about PyODE. I thnk Soya or PySoy is integrating this soon, so I will be looking into that. thx -- http://mail.python.org/mailman/

Re: upload a file

2006-07-25 Thread placid
[EMAIL PROTECTED] wrote: > Dear all, > > could you give me an help ? > > I would to upload a file from web using Python. Is there a simple way to do > this? I'm using the cgi module and python 2.3. The file to be uploaded is a > text > file. > is this what your after? http://aspn.activestate.co

Re: threading+ftp+import => block

2006-07-25 Thread Damjan
Damjan wrote: > Panard wrote: > >> Hi, >> I'm experiencing a strange problem while trying to manage a ftp >> connection into a separate thread. >> >> I'm on linux, python 2.4.3 >> >> Here is a test : >> -- ftp_thread.py -- >> import ftplib >> import threading >> import datetime >> >> c

Re: threading+ftp+import => block

2006-07-25 Thread Damjan
Panard wrote: > Hi, > I'm experiencing a strange problem while trying to manage a ftp connection > into a separate thread. > > I'm on linux, python 2.4.3 > > Here is a test : > -- ftp_thread.py -- > import ftplib > import threading > import datetime > > class test( threading.Thread ) :

Re: HELP!!! How do I send an ACK packet in UDP?????

2006-07-25 Thread Joe Knapka
[EMAIL PROTECTED] wrote: > Yes, you were right it was already there (sorry, my mistake), the > bigger problem is how do I send an ack packet Look at the docs for socket.sendto(). Of course, deciding what data should be in your "ACK" packet is for you to decide. Cheers, -- JK -- http://

Re: Parsing Baseball Stats

2006-07-25 Thread Paul McGuire
"Anthra Norell" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > Paul, > > I think self-respect is a very essential attitude and I am pleased to know that you value it as much as I do. > The off topic thus dispatched, let me first express my appreciation or your interest. Next

Re: HELP!!! How do I send an ACK packet in UDP?????

2006-07-25 Thread myersoft
Yes, you were right it was already there (sorry, my mistake), the bigger problem is how do I send an ack packet Joe Knapka wrote: > [EMAIL PROTECTED] wrote: > > > I need my udp server to send an ACK back to the client when it > > successfully receives data from the client to let it know no

xmlrpclib and methods declared at runtime

2006-07-25 Thread squid
First off, I'm a python neophyte, but I'm fairly experienced with Java, C and PHP. I've been trying to use the xmlrpclib to perform remote calls against a service, and it works nicely. However, due to my lack of python-knowledge, I'm rather puzzled at the way the class works. Specifically, suppos

Re: Coding style

2006-07-25 Thread Gerhard Fiedler
On 2006-07-25 17:59:22, Antoon Pardon wrote: >> My view is: I ask for help on a public forum. I get what I get... and if >> I consider that someone who responded with something that's not >> immediately helpful has a potential to help me better, I try to get in >> a dialog and address what has bee

Re: Need a compelling argument to use Django instead of Rails

2006-07-25 Thread Joe Knapka
John J. Lee wrote: > The fact that "open classes" are apparently thought to be a good thing > in Ruby puzzles (and worries) me. This objection strikes me as having the same nature as, "Python's lack of strong protection for class members puzzles (and worries) me". The Pythonic answer to that obj

Re: find_longest_match in SequenceMatcher

2006-07-25 Thread koara
Hello again John -- your hack/fix seems to work. Thanks a lot, now let's hope timbot will indeed be here shortly with a proper fix =) -- http://mail.python.org/mailman/listinfo/python-list

Re: Converting a web to pdf or ..‍

2006-07-25 Thread Bayazee
Colin J. Williams wrote: > You might consider using OpenOffice and talking to it through PyUno. > > Colin W. Hi TanX for replies ... i want to use it in linux server so i havent OOO or ... other X program . i want a way similer this : http://www.easysw.com/htmldoc/ u can test it here : http://www

Re: Parsing Baseball Stats

2006-07-25 Thread Anthra Norell
- Original Message - From: "Paul McGuire" <[EMAIL PROTECTED]> Newsgroups: comp.lang.python To: Sent: Tuesday, July 25, 2006 7:48 PM Subject: Re: Parsing Baseball Stats > "Anthra Norell" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Hi, > > > > Below your soluti

Re: Coding style

2006-07-25 Thread Antoon Pardon
On 2006-07-23, Gerhard Fiedler <[EMAIL PROTECTED]> wrote: > On 2006-07-23 06:24:09, Antoon Pardon wrote: > >>> In general, I'd say that in this case the example was not well-chosen. >>> After such a "shudder removal", a poster should IMO review what caused >>> the shudder, and rephrase the original

can wxpython checkbox use the "fill in" marker instead of the "check"?

2006-07-25 Thread jojoba
hello all, does anyone know if, for a 2-state checkbox, you can use the "fill in" marker from the 3-state checkbox, instead of a checkmark i just like the look of the "fill-in" instead of the checkmark Thanks, jojoba -- http://mail.python.org/mailman/listinfo/python-list

Re: Python stack trace on blocked running script.

2006-07-25 Thread Jean-Paul Calderone
On Tue, 25 Jul 2006 13:20:18 -0700, Rich Burridge <[EMAIL PROTECTED]> wrote: > >Hi all, > >If this is a frequently asked question, then just slap me silly and point me >in the right direction. > >We are currently experiencing a hanging problem with Orca [1], a >screen reader/magnifier written in Py

xmlrpc: hostname nor servname provided ?

2006-07-25 Thread Laszlo Nagy
I'm running a service on a machine. The service is written in Python (of course) and it connects to an XMLRPC server periodically. It recreates the ServerProxy instance each time it needs to connect to the RPC server. The server is created with this code: server = xmlrpclib.ServerProxy(local.SE

Python stack trace on blocked running script.

2006-07-25 Thread Rich Burridge
Hi all, If this is a frequently asked question, then just slap me silly and point me in the right direction. We are currently experiencing a hanging problem with Orca [1], a screen reader/magnifier written in Python. We know how to get a stack trace of the current thread in a Python problem, but

Re: cStringIO.StringIO has no write method?

2006-07-25 Thread Laszlo Nagy
> from cStringIO documentation: > > > Another difference from the StringIO module is that calling > StringIO() with a string parameter creates a read-only object. > Unlike an object created without a string parameter, it does > not have write methods. > Looks like I did not

Re: range() is not the best way to check range?

2006-07-25 Thread Antoon Pardon
On 2006-07-23, Paul Boddie <[EMAIL PROTECTED]> wrote: > Antoon Pardon wrote: >> >> Except that if you write your own class from scratch, you can't use >> it as a slice. > > Correct, but we were actually discussing subclassing built-in classes > for use as a replacement for range/xrange. :-) I thin

Re: Missing rotor module

2006-07-25 Thread skip
Nick> I still don't know why it was ever included in Python. It was another time and place altogether than the world we live in today. Python was a much smaller language and had a much smaller following. Concerns about security were minimal (relative to today anyway). Skip -- http://mail.py

Accessing files on a PocketPC device

2006-07-25 Thread walterbyrd
I want my python app to read a file from a pocketpc mobile device, if possible. Assume I am running windows-xp, and activesync 3.8. Assume I have "exported" the file. As I understand it, exported files are not really on the PC, even after syncing. You have to use your stylus on the PDA to get to

Re: Need a compelling argument to use Django instead of Rails

2006-07-25 Thread Yannick
Hi, A few months ago I had to choose between RoR and a Python framework (TurboGears in that case). I picked TurboGears because of the language maturity and all the third party libs. i.e. I can do PDF reporting with reportLab, control OpenOffice with Python.. Ruby has still a "cool factor" going wi

Re: cStringIO.StringIO has no write method?

2006-07-25 Thread Simon Forman
Laszlo Nagy wrote: > >> > > Nope. StringI is an input-only object, StringO is an output object. You > > got a StringI because you gave a string argument to the creator. > > > > > > >>> f1 = cStringIO.StringIO() > > >>> f1 > > > > >>> dir(f1) > > ['__class__', '__delattr__', '__doc__', '__getat

Re: Nested function scope problem

2006-07-25 Thread Gerhard Fiedler
On 2006-07-25 13:33:40, Dennis Lee Bieber wrote: >> Surprising for me are actually two things: 1- the fact itself, and 2- that >> term "binding", and that whatever it means (I'll have to read more on that, >> now that I know the term) is different for read-only and read/write access. >> > Binding

Re: cStringIO.StringIO has no write method?

2006-07-25 Thread Jarek Zgoda
Laszlo Nagy napisał(a): >> Nope. StringI is an input-only object, StringO is an output object. >> You got a StringI because you gave a string argument to the creator. >> >> >> >>> f1 = cStringIO.StringIO() >> >>> f1 >> >> >>> dir(f1) >> ['__class__', '__delattr__', '__doc__', '__getattribute__

Re: cStringIO.StringIO has no write method?

2006-07-25 Thread Laszlo Nagy
>> > Nope. StringI is an input-only object, StringO is an output object. You > got a StringI because you gave a string argument to the creator. > > > >>> f1 = cStringIO.StringIO() > >>> f1 > > >>> dir(f1) > ['__class__', '__delattr__', '__doc__', '__getattribute__', '__hash__', > '__ini

Re: cStringIO.StringIO has no write method?

2006-07-25 Thread Alexis Roda
En/na Laszlo Nagy ha escrit: > This program: > > import sys > import traceback > import cStringIO > > a = 1.0 > b = 0.0 > try: >c=a/b > except: f = cStringIO.StringIO('') >ei = sys.exc_info() >traceback.print_exception(ei[0],ei[1],ei[2],file=f) from cStringIO documentation:

Re: cStringIO.StringIO has no write method?

2006-07-25 Thread Peter Otten
Laszlo Nagy wrote: > This program: > > import sys > import traceback > import cStringIO > > a = 1.0 > b = 0.0 > try: > c=a/b > except: > f = cStringIO.StringIO('') > ei = sys.exc_info() > traceback.print_exception(ei[0],ei[1],ei[2],file=f) > > raises this exception: > > Traceba

Re: cStringIO.StringIO has no write method?

2006-07-25 Thread Steve Holden
Laszlo Nagy wrote: > This program: > > import sys > import traceback > import cStringIO > > a = 1.0 > b = 0.0 > try: > c=a/b > except: > f = cStringIO.StringIO('') > ei = sys.exc_info() > traceback.print_exception(ei[0],ei[1],ei[2],file=f) > > raises this exception: > > Trac

Re: Generating all possible combination of elements in a list

2006-07-25 Thread Mir Nazim
> Again, I don't understand. You have 924 things, eliminate some of them, > and end up with 1060 things? Eliminating elements should decrease > the number, not increase it. yes, u are right I had to types of lists: one one them has 924 permutations and other has 792 making them 1722. out of which

Re: How to automate user input at the command prompt?

2006-07-25 Thread gert365
Cameron Laird wrote: > In article <[EMAIL PROTECTED]>, > [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > >In that case, the OP can probably use cygwin's version of python. > >pexpect definitely works there. > . > . > . > I suspec

Re: How to force a thread to stop

2006-07-25 Thread Gerhard Fiedler
On 2006-07-25 13:55:39, Carl J. Van Arsdall wrote: > I'd be all for using processes but setting up communication between > processes would be difficult wouldn't it? I mean, threads have shared > memory so making sure all threads know the current system state is an > easy thing. I'm not sure ab

Re: Python and C++

2006-07-25 Thread Roman Yakovenko
On 7/25/06, Dave Kuhlman <[EMAIL PROTECTED]> wrote: > KraftDiner wrote: > > > What ways can I call my C++ classes from within Python. > > I've looked at boost but it would appear that there is little > > support or knowledge on boost in the python community. > > If you want to write Python wrappers

Re: Missing rotor module

2006-07-25 Thread Nick Vatamaniuc
Unfortunately rotor has been deprecated but it hasn't been replaced with anything reasonable as far as encryption goes -- there are just a bunch of hashing funtions (sha, md5) only. If you need to replace rotor all together I would sugest the crypto library from: http://www.amk.ca/python/code/cryp

Re: smtplib timeout

2006-07-25 Thread Alan Kennedy
[Stuart D. Gathman] >>> I need to set a timelimit for the operation of >>> smtplib.sendmail. It has to be thread based, because pymilter uses >>> libmilter which is thread based. [Alan Kennedy] >> Have you tried setting a default socket timeout, which applies to all >> socket operations? [Stuart

Re: Generating all possible combination of elements in a list

2006-07-25 Thread Mir Nazim
> Again, I don't understand. You have 924 things, eliminate some of them, > and end up with 1060 things? Eliminating elements should decrease > the number, not increase it. yes, u are right I had to types of lists: one one them has 924 permutations and other has 792 making them 1722. out of which

cStringIO.StringIO has no write method?

2006-07-25 Thread Laszlo Nagy
This program: import sys import traceback import cStringIO a = 1.0 b = 0.0 try: c=a/b except: f = cStringIO.StringIO('') ei = sys.exc_info() traceback.print_exception(ei[0],ei[1],ei[2],file=f) raises this exception: Traceback (most recent call last): File "C:/Documents and

Re: How to force a thread to stop

2006-07-25 Thread olsongt
Carl J. Van Arsdall wrote: > Jean-Paul Calderone wrote: > > On Mon, 24 Jul 2006 11:22:49 -0700, "Carl J. Van Arsdall" <[EMAIL > > PROTECTED]> wrote: > > > >> Steve Holden wrote: > >> > >>> Carl J. Van Arsdall wrote: > >>> [... rant ...] > >>> > >>> > So with this whole "hey mr. nice thread,

Re: dicts vs classes

2006-07-25 Thread Nick Vatamaniuc
Don't optimize prematurely. Write whatever is cleaner, simpler and makes more sense. Such that if someone (or even yourself) looks at it 10 years from now they'll know exactly what is going on. As far as what is slower or what functionality you will use and what you won't -- well, if you won't us

Re: Python and C++

2006-07-25 Thread Dave Kuhlman
KraftDiner wrote: > What ways can I call my C++ classes from within Python. > I've looked at boost but it would appear that there is little > support or knowledge on boost in the python community. If you want to write Python wrappers for C++ code *by hand*, look here: http://docs.python.org/

Re: wxPython Grid XY Coordinates question

2006-07-25 Thread Kiran
Will, thank you. That was the right thing to do, and it worked -- Kiran Will McGugan wrote: > Kiran wrote: > > Hello All, > > I am writing an app in wxPython using a grid. I need to be able to > > recognize what cell in the grid the user is hovering over with the > > mouse. How to do this? >

Re: Need a compelling argument to use Django instead of Rails

2006-07-25 Thread John J. Lee
"Ray" <[EMAIL PROTECTED]> writes: > I just moved to another company that's mainly a Java/.NET shop. I was > happy to find out that there's a movement from the grassroot to try to > convince the boss to use a dynamic language for our development! > > Two of the senior developers, however, are alre

Re: Need a compelling argument to use Django instead of Rails

2006-07-25 Thread John J. Lee
Steve Holden <[EMAIL PROTECTED]> writes: [...] > Well, my view is that both are frameworks, and so you will inevitably > "run out of steam" at some point if your implementation plans become too > ambitious. The impression I get is that Rails is relatively inflexible > on database schemas, and on

Re: self question

2006-07-25 Thread Schüle Daniel
correction :) > class Graph: > settings = { > "NumNodes" : 10, > "MinNodes" : 2, > "MaxNodes" : 5 > } > def randomizeEdges(self, > lowhigh = (settings["MinNodes"], settings["MaxNodes"])): of course this should be Graph.settings["MinNodes"], Graph.sett

Re: Need a compelling argument to use Django instead of Rails

2006-07-25 Thread John J. Lee
Sybren Stuvel <[EMAIL PROTECTED]> writes: [...] > - What I was told from a professor in formal languages, which is > that there is no formal definition of the Ruby language. That's > enough for me to not use it. [...] So you're not using Python either? Probably I don't understand

Re: Python and C++

2006-07-25 Thread Roman Yakovenko
On 25 Jul 2006 10:51:36 -0700, KraftDiner <[EMAIL PROTECTED]> wrote: > What ways can I call my C++ classes from within Python. > I've looked at boost but it would appear that there is little > support or knowledge on boost in the python community. It is not true! I am sure that if you ask you ques

Re: self question

2006-07-25 Thread Schüle Daniel
[EMAIL PROTECTED] schrieb: >> cnt = 1 >> def foo(): >> global cnt >> cnt += 1 >> return cnt >> >> def bar(x=foo()): >> print x >> >> bar()# 2 >> bar()# 2 >> bar()# 2 > > Looks to me like you want to use the following programming pattern to > get dynamic

Re: Python and Boost.

2006-07-25 Thread Roman Yakovenko
On 25 Jul 2006 08:01:30 -0700, KraftDiner <[EMAIL PROTECTED]> wrote: > Hi, I'm trying to call a C++ class from python. > I've looked around and the solution would appear to be boost. Right! > I'm not sure but maybe I've downloaded and installed the entire boost > library, > when there is probably

Python and C++

2006-07-25 Thread KraftDiner
What ways can I call my C++ classes from within Python. I've looked at boost but it would appear that there is little support or knowledge on boost in the python community. -- http://mail.python.org/mailman/listinfo/python-list

Re: Parsing Baseball Stats

2006-07-25 Thread Paul McGuire
"Anthra Norell" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > Below your solution ready to run. Put get_statistics () in a loop that feeds it the names from your file, makes an ouput file > name from it and passes both 'statistics' and the ouput file name to file_stati

Re: Grail not downloading

2006-07-25 Thread Martin v. Löwis
Dustan wrote: > I appreciate the info. I couldn't exactly attempt to download the files > manually, though. ;) Learn to use CVS, then go to http://sourceforge.net/cvs/?group_id=6416 Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: self question

2006-07-25 Thread dan . gass
> cnt = 1 > def foo(): > global cnt > cnt += 1 > return cnt > > def bar(x=foo()): > print x > > bar() # 2 > bar() # 2 > bar() # 2 Looks to me like you want to use the following programming pattern to get dynamic default arguments: cnt = 1 def foo(): global cnt

Re: Generating all possible combination of elements in a list

2006-07-25 Thread Martin v. Löwis
Mir Nazim wrote: > condition are there cannot be more than 3 consecutive 2's or 1's > >> If the task is to produce all distinct permutations of 6 occurrences >> of 1 and 6 occurrences of 2, I suggest the program below. It needs >> produces much fewer than 12! results (namely, 924). >> > > Yes tha

self question

2006-07-25 Thread Schüle Daniel
Hi all, given python description below import random class Node: def __init__(self): self.nachbarn = [] class Graph(object): # more code here def randomizeEdges(self, low=1, high=self.n): pass graph = Graph(20) graph.randomizeEdges(2

Re: doctest with variable return value

2006-07-25 Thread Peter Otten
3KWA wrote: > I am wondering what is the standard doctest (test) practice for > functions who's returned value change all the time e.g. forex rate: > > import urllib > > def get_rate(symbol): > """get_rate(symbol) connects to yahoo finance to return the rate of > symbol. > > >>>get_rate

Re: simple question

2006-07-25 Thread Schüle Daniel
Steve Holden schrieb: > Maxine Weill wrote: >> I need to install Python Imaging Library (PIL) - imaging-1.1.5.tar.gz >> (source ) onto Suse Linux 10.1 system in order for (latest) Scribus >> 1.3.3.2 to install and work. >> >> Plesae indicate how I perform PIL install (exact commands/procedures)

Re: How to force a thread to stop

2006-07-25 Thread Paul Rubin
"Carl J. Van Arsdall" <[EMAIL PROTECTED]> writes: > I'd be all for using processes but setting up communication between > processes would be difficult wouldn't it? I mean, threads have > shared memory so making sure all threads know the current system > state is an easy thing. With processes woul

Re: an "urgent" answer to a simple question

2006-07-25 Thread Tim Chase
> I need to install Python Imaging Library (PIL) - > imaging-1.1.5.tar.gz (source ) onto Suse Linux 10.1 system in > order for (latest) Scribus 1.3.3.2 to install and work. Not being a Suse user, I'm flying by the seat of my pants. My recommendation: Install debian, and use "apt-get install pytho

Re: smtplib timeout

2006-07-25 Thread Stuart D. Gathman
On Tue, 25 Jul 2006 09:21:40 -0700, Alan Kennedy wrote: > [Stuart D. Gathman] >> I need to set a timelimit for the operation of >> smtplib.sendmail. It has to be thread based, because pymilter uses >> libmilter which is thread based. > > Have you tried setting a default socket timeout, which app

Re: print function question

2006-07-25 Thread Simon Forman
Bertrand-Xavier M. wrote: > On Tuesday 25 July 2006 05:52, Eric Bishop wrote: > > Why does this work: > > > > # start > > a = 5 > > > > print a, 'is the number' > > > > #end, prints out "5 is the number" > > > > But not this: > > > > # start > > > > a = 5 > > > > print a 'is the number' > > > > #en

Re: Don't use __slots__! (was Re: dicts vs classes)

2006-07-25 Thread Roy Smith
>Guido sez: > > __slots__ is a terrible hack with nasty, hard-to-fathom side > effects that should only be used by programmers at grandmaster and > wizard levels. Unfortunately it has gained an enormous undeserved > popularity amongst the novices and apprentices, who should know >

Re: Help in string.digits functions

2006-07-25 Thread Simon Forman
John McMonagle wrote: > On Mon, 2006-07-24 at 22:19 -0700, Anoop wrote: > > Hi All > > > > I am getting two different outputs when i do an operation using > > string.digits and test.isdigit(). Is there any difference between the > > two. I have given the sample program and the output > > > > Thanks

Re: simple question

2006-07-25 Thread Steve Holden
Maxine Weill wrote: > I need to install Python Imaging Library (PIL) - imaging-1.1.5.tar.gz > (source ) onto Suse Linux 10.1 system in order for (latest) Scribus 1.3.3.2 > to install and work. > > Plesae indicate how I perform PIL install (exact commands/procedures) in > manner where files ar

Re: Nested function scope problem

2006-07-25 Thread Terry Reedy
"Dennis Lee Bieber" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > The names in the parameter list of the "def" statement are bound to > the objects associated with the actual call. After that, they behave > very much as locals... Now -- with defaults it gets a touch trickier... A

Re: How to force a thread to stop

2006-07-25 Thread Carl J. Van Arsdall
Gerhard Fiedler wrote: > On 2006-07-25 13:30:22, Carl J. Van Arsdall wrote: > > >>> Running os.system() in multiple threads strikes me as kind of whacked. >>> Won't they all compete to read and write stdin/stdout simultaneously? >>> >>> >> Unfortunately this is due to the nature of the p

simple question

2006-07-25 Thread Maxine Weill
I need to install Python Imaging Library (PIL) - imaging-1.1.5.tar.gz (source ) onto Suse Linux 10.1 system in order for (latest) Scribus 1.3.3.2 to install and work. Plesae indicate how I perform PIL install (exact commands/procedures) in manner where files are "automatically" placed in prop

Re: How to force a thread to stop

2006-07-25 Thread Gerhard Fiedler
On 2006-07-25 13:30:22, Carl J. Van Arsdall wrote: >> Running os.system() in multiple threads strikes me as kind of whacked. >> Won't they all compete to read and write stdin/stdout simultaneously? >> > Unfortunately this is due to the nature of the problem I am tasked with > solving. I have a

Re: How to force a thread to stop

2006-07-25 Thread Carl J. Van Arsdall
[EMAIL PROTECTED] wrote: > Carl J. Van Arsdall wrote: > [...] > >> My problem with the fact that python doesn't have some type of "thread >> killer" is that again, the only solution involves some type of polling >> loop. >> > > A polliing loop is neither required nor helpful here. > > [...]

Re: About Embedding PyWin or wxPython

2006-07-25 Thread Philippe Martin
Mr. Roboto wrote: > Phillipe: Actually, it's not performance of the core app that concerns > me. I'm thinking more about UI/form *design* productivity. I've done > a lot of Access work over the years and while the stand-alone VB form > designer isn't quite as thorough, it's still one of the sli

Re: smtplib timeout

2006-07-25 Thread Alan Kennedy
[Stuart D. Gathman] > I need to set a timelimit for the operation of > smtplib.sendmail. It has to be thread based, because pymilter uses > libmilter which is thread based. There are some cookbook recipies which > run a function in a new thread and call Thread.join(timeout). This > doesn't help,

Re: Nested function scope problem

2006-07-25 Thread Bruno Desthuilliers
Gerhard Fiedler wrote: > On 2006-07-25 04:06:24, Steve Holden wrote: > > >>Dennis Lee Bieber wrote: >> >>>On Mon, 24 Jul 2006 17:35:50 -0300, Gerhard Fiedler <[EMAIL PROTECTED]> >>>declaimed the following in comp.lang.python: >>> >>> It is surprising in the sense that binding seems not to be

Re: Don't use __slots__! (was Re: dicts vs classes)

2006-07-25 Thread Aahz
In article <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> wrote: >Aahz, citing Guido: >> >>__slots__ is a terrible hack with nasty, hard-to-fathom side >>effects that should only be used by programmers at grandmaster and >>wizard levels. Unfortunately it has gained an enormous undeserved > >I think I ha

Re: micro authoritative dns server

2006-07-25 Thread xan2
Lawrence D'Oliveiro wrote: > In message <[EMAIL PROTECTED]>, > [EMAIL PROTECTED] wrote: > > > I just want to know if anyone could help me in writing a code for > > minimal authoritative dns server. > > You'll probably need to start by reading and understanding RFC1034 and > RFC1035. Yes. But these

Re: dicts vs classes

2006-07-25 Thread Simon Forman
Simon Hibbs wrote: > I'm wondering about whether to use objects in this way or dictionaries > for a program I'm writing at the moment. It seems to me that unless you > need some of the functionality supplied with dictionaries (len(a), > has_key, etc) then simple objects are a syntacticaly cleaner a

Re: Paste text across multiple text boxes

2006-07-25 Thread dpryan
Thanks! This will get me started. Simon Hibbs wrote: > This link seems to have some relevent code. > > http://lists.wxwidgets.org/archive/wxPython-users/msg07340.html > > Simon Hibbs -- http://mail.python.org/mailman/listinfo/python-list

Re: About Embedding PyWin or wxPython

2006-07-25 Thread Mr. Roboto
Phillipe: Actually, it's not performance of the core app that concerns me. I'm thinking more about UI/form *design* productivity. I've done a lot of Access work over the years and while the stand-alone VB form designer isn't quite as thorough, it's still one of the slickest out there. Unfortuna

Python audio output switch

2006-07-25 Thread Pan Xingzhi
Guys: Hi there. Recently I'll have to write a quite interesting program in Python on a Linux box. What I need is a function which allows the user to 'switch' the audio output from //. I'm not quite familiar with Linux programming. I've checked some python media frameworks but still n

Re: Don't use __slots__! (was Re: dicts vs classes)

2006-07-25 Thread bearophileHUGS
Aahz, citing Guido: >__slots__ is a terrible hack with nasty, hard-to-fathom side >effects that should only be used by programmers at grandmaster and >wizard levels. Unfortunately it has gained an enormous undeserved I think I have used __slots__ just one time. Can you tell me some of of such bad

smtplib timeout

2006-07-25 Thread Stuart D. Gathman
I am doing SMTP callbacks in a Python milter (http://pymilter.sourceforge.net) using the smtplib module. For some spammer MXes, it takes days (!) before smtplib.sendmail will return. Since the spammer connects to us every few seconds, this quickly leads to a problem :-) I need to set a timelimit

  1   2   >