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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

<    1   2