How to get all the variables in a python shell

2008-05-28 Thread lixinyi . 23
Hi! I'm currently working on a scientific computation software built in python. What I want to implement is a Matlab style command window <-> workspace interaction. For example, you type 'a=1' in the command window, and you see a list item named 'a' in the workspace. You double click the icon of

Re: Optimization: Picking random keys from a dictionary and mutating values

2008-05-28 Thread Raymond Hettinger
On May 28, 4:41 pm, blaine <[EMAIL PROTECTED]> wrote: > 1.  Whats a good way to get the keys? I'm using a loop with > random.choice() at the moment. Why not keep a separate list of keys and use random.sample()? Raymond -- http://mail.python.org/mailman/listinfo/python-list

Re: Struct usages in Python

2008-05-28 Thread Alok Kumar
Thanks to everyone for your help. I am able to use array of structure (here Event is a class) in the following manner. But here I am fixing the array index as 4. Is there any easy way to keep it appending dynamically. self.event = [Event() for x in range(4)] # Event is a class as posted in origi

adding tkinter support on an existing python installation

2008-05-28 Thread Rahul
'import _tkinter' fails on my system. I wanted to enable tk support. I do have tk and tk-devel installed (but they weren't around when we installed python). What's the best way to get these modules into python? I hope I do not have to reinstall python itself? Or do I? -- Rahul -- http://mail.

Re: pydb remote debugging/cmd.Cmd over socket?

2008-05-28 Thread R. Bernstein
"Diez B. Roggisch" <[EMAIL PROTECTED]> writes: > Hi, > > I'm fiddling around with pydb. Installation and usage are fine. What I > especially like is the fact that you can attach a signal such that you drop > into debugging mode on demand. > > But this is of limited use to me in situations where a

Re: Any way to loop through object variables?

2008-05-28 Thread Saju Pillai
On 28-May-08, at 9:49 PM, Gary Herron wrote: Dave Challis wrote: Hi, Just wondering if there's a way to iterate through all variables which an object has set? Specifically, I'm using the OptionParser module, which returns an options object, containing all command line options as object v

Re: FW: php vs python

2008-05-28 Thread Carl Banks
On May 28, 7:45 pm, blaine <[EMAIL PROTECTED]> wrote: > On May 28, 4:47 pm, "Phil Runciman" <[EMAIL PROTECTED]> > wrote: > > > > > -Original Message- > > From: Jerry Stuckle [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, 28 May 2008 1:48 p.m. > > To: [EMAIL PROTECTED] > > Subject: Re: php v

Re: accessing class attributes

2008-05-28 Thread Matimus
> I have a game class, and the game has a state. Seeing that Python has > no enumeration type, at first I used strings to represent states: > "paused", "running", etc. But such a representation has many > negatives, so I decided to look at the Enum implementation given > here:http://aspn.activesta

Re: multi dimensional dictionary

2008-05-28 Thread Alok Kumar
Thanks to all for their kind help and time. Alok On Wed, May 28, 2008 at 4:11 AM, Peter Otten <[EMAIL PROTECTED]> wrote: > Gary Herron wrote: > > > Alok Kumar wrote: > >> Dear All, > >> > >> I am using dictionary for filling my xpath parsed data. > >> > >> I wanted to use in the following manner

Re: Python and Flaming Thunder

2008-05-28 Thread Giampaolo Rodola'
On 28 Mag, 23:13, Dave Parker <[EMAIL PROTECTED]> wrote: > On May 28, 12:09 pm, Luis Zarrabeitia <[EMAIL PROTECTED]> wrote: > > > Following your posts in this thread, I see that > > you 'plan to add soon' every cool feature that every other language seems to > > have. > > I've already added a lot o

Re: convert string number to real number - ValueError: invalid literal for int() with base 10: '"2"'

2008-05-28 Thread Kam-Hung Soh
Matthias Bläsing wrote: Am Wed, 28 May 2008 10:41:51 -0700 schrieb davidj411: I like the str2num function approach, but then i get left with a float that has more than 2 decimal spaces , i.e. 11.50 becomes 11.449 and round will not fix that. Welcome to the wonderful world of float

Re: Threads and import

2008-05-28 Thread Peter Otten
[EMAIL PROTECTED] wrote: > Hi, > > I'm trying to work out some strange (to me) behaviour that I see when > running a python script in two different ways (I've inherited some > code that needs to be maintained and integrated with another lump of > code). The sample script is: > > # Sample script,

Re: FW: php vs python

2008-05-28 Thread blaine
On May 28, 4:47 pm, "Phil Runciman" <[EMAIL PROTECTED]> wrote: > -Original Message- > From: Jerry Stuckle [mailto:[EMAIL PROTECTED] > Sent: Wednesday, 28 May 2008 1:48 p.m. > To: [EMAIL PROTECTED] > Subject: Re: php vs python > > Ivan Illarionov wrote: > > On Wed, 28 May 2008 05:10:20 +0400

Re: Python's tail -f implementation for remote files

2008-05-28 Thread Dikkie Dik
asdf wrote: Basically what i want to do is to read a file that is being constantly appended to but which is located on a remote server. I found this for doing BASH's tail -f in python: import os tailoutputfile = os.popen('tail -f syslog') while 1: line = tailoutputfile.readline() if len(

Optimization: Picking random keys from a dictionary and mutating values

2008-05-28 Thread blaine
Hey everyone, Just a friendly question about an efficient way to do this. I have a graph with nodes and edges (networkx is am amazing library, check it out!). I also have a lookup table with weights of each edge. So: weights[(edge1, edge2)] = .12 weights[(edge2, edge5)] = .53 weights[(edge5,

Python's tail -f implementation for remote files

2008-05-28 Thread asdf
Basically what i want to do is to read a file that is being constantly appended to but which is located on a remote server. I found this for doing BASH's tail -f in python: import os tailoutputfile = os.popen('tail -f syslog') while 1: line = tailoutputfile.readline() if len(line)==0: #

Re: Writing a function from within Python

2008-05-28 Thread George Sakkis
On May 28, 4:39 pm, Aaron Scott <[EMAIL PROTECTED]> wrote: > Is it possible to change the content of a function after the function > has been created? For instance, say I make a class: > > class MyClass: > def ClassFunction(self): > return 1 > > And I

Re: Python and Flaming Thunder

2008-05-28 Thread Diez B. Roggisch
To be fair, the graphics look cool and the "single-asset 8-by-8 shotgun cross compiler, written entirely in assembly language" sounds impressive from an implementation point of view, in the sense that building Deep Blue with nothing but NAND gates would; utterly impressive and pointless at the s

Re: Python and Flaming Thunder

2008-05-28 Thread Diez B. Roggisch
Dave Parker schrieb: On May 28, 3:19 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: Kind of like how this year's program won't work on next year's Python? For somebody who has admitted to have only very rudimentary knowledge of python that's a pretty bold statement, don't you think? Everth

Traling white space on program source lines (was: Simple Doc Test failing without any reason [Help Needed])

2008-05-28 Thread Ben Finney
afrobeard <[EMAIL PROTECTED]> writes: > >>> sanitize_number('0321-4683113') >>> brackets> > > Apparently they caused the test case to fail on this. > > Weird behavior :/ Nope, exactly as specified: doctest is reporting differences berween what output was generated and what output you described.

Re: Python and Flaming Thunder

2008-05-28 Thread George Sakkis
On May 28, 5:19 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > Kind of like how this year's program won't work on next year's > > Python? > > For somebody who has admitted to have only very rudimentary knowledge of > python that's a pretty bold statement, don't you think? > > > Except Flam

Re: definition of a highlevel language?

2008-05-28 Thread Avowkind
On May 29, 5:32 am, Stef Mientki <[EMAIL PROTECTED]> wrote: > Avowkind wrote: > > On May 27, 6:34 am, [EMAIL PROTECTED] wrote: > > >> (might not be the right forum for this but...) > > >> what is the definition of a highlevel-language? > > >> well there isnt one specifically and wikipedia and the l

Re: Threads and import

2008-05-28 Thread Diez B. Roggisch
Python 2.4.4 (#1, Oct 18 2006, 10:34:39) [GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin Type "help", "copyright", "credits" or "license" for more information. import TestThread # from TestThread.py If I use python 2.5, this doesn't happen - instead, the module ist just run. If I use py

Re: Python and Flaming Thunder

2008-05-28 Thread Dave Parker
On May 28, 3:19 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > Kind of like how this year's program won't work on next year's > > Python? > > For somebody who has admitted to have only very rudimentary knowledge of > python that's a pretty bold statement, don't you think? Everthing I know,

Re: Threads and import

2008-05-28 Thread rsoh . woodhouse
On May 28, 10:24 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] schrieb: > > > > > On May 28, 8:52 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > >> [EMAIL PROTECTED] schrieb: > > >>> On May 28, 8:26 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECT

Re: Python and Flaming Thunder

2008-05-28 Thread Dave Parker
On May 28, 12:48 pm, "Dan Upton" <[EMAIL PROTECTED]> wrote: > there's no reason "set" itself > should throw any sort of error in the sense of an exception--in a > statement like "Set x to SomeFunctionThatCanBlowUp()", the semantics > should clearly be that the error comes from the function.  In a s

Re: Threads and import

2008-05-28 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: On May 28, 8:52 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: [EMAIL PROTECTED] schrieb: On May 28, 8:26 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: [EMAIL PROTECTED] schrieb: Hi, I'm trying to work out some strange (to me) behaviour that I see when run

Re: datetime.stdptime help

2008-05-28 Thread Mike Driscoll
On May 28, 12:19 pm, mblume <[EMAIL PROTECTED]> wrote: > Am Tue, 27 May 2008 12:37:34 -0700 schrieb Dennis Lee Bieber: > > >    From the library reference: > > """ > > Support for the %Z directive is based on the values contained in tzname > > and whether daylight is true. Because of this, it is pl

Re: Threads and import

2008-05-28 Thread rsoh . woodhouse
On May 28, 8:52 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] schrieb: > > > > > On May 28, 8:26 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > >> [EMAIL PROTECTED] schrieb: > > >>> Hi, > >>> I'm trying to work out some strange (to me) behaviour that I see when > >>> ru

Re: Python and Flaming Thunder

2008-05-28 Thread Diez B. Roggisch
Kind of like how this year's program won't work on next year's Python? For somebody who has admitted to have only very rudimentary knowledge of python that's a pretty bold statement, don't you think? Except Flaming Thunder is faster. ;) Faster in execution speed for a very limited domain

Re: Python and Flaming Thunder

2008-05-28 Thread Dave Parker
On May 28, 12:09 pm, Luis Zarrabeitia <[EMAIL PROTECTED]> wrote: > Following your posts in this thread, I see that > you 'plan to add soon' every cool feature that every other language seems to > have. I've already added a lot of them. For example, loops that don't need looping variables: For 10

Re: php vs python

2008-05-28 Thread Eric Wertman
Flaming Thunder is teh awesome! :P -- http://mail.python.org/mailman/listinfo/python-list

FW: php vs python

2008-05-28 Thread Phil Runciman
-Original Message- From: Jerry Stuckle [mailto:[EMAIL PROTECTED] Sent: Wednesday, 28 May 2008 1:48 p.m. To: python-list@python.org Subject: Re: php vs python Ivan Illarionov wrote: > On Wed, 28 May 2008 05:10:20 +0400, AnrDaemon wrote: > >> Greetings, Ivan Illarionov. >> In reply to Yo

Custom log handler and logging.config.fileConfig()

2008-05-28 Thread Lowell Alleman
Here is the situation: I wrote my own log handler class (derived from logging.Handler) and I want to be able to use it from a logging config file, that is, a config file loaded with the logging.config.fileConfig() function. Let say my logging class is called "MyLogHandler" and it's in a module ca

Re: Writing a function from within Python

2008-05-28 Thread Arnaud Delobelle
Aaron Scott <[EMAIL PROTECTED]> writes: > Is it possible to change the content of a function after the function > has been created? For instance, say I make a class: > > class MyClass: > def ClassFunction(self): > return 1 > > And I create an object: > >

Writing a function from within Python

2008-05-28 Thread Aaron Scott
Is it possible to change the content of a function after the function has been created? For instance, say I make a class: class MyClass: def ClassFunction(self): return 1 And I create an object: MyObject = MyClass() Is there any way to cha

Re: BeautifulSoup: problems with parsing a website

2008-05-28 Thread Stefan Behnel
Marco Hornung wrote: > Hy guys, ... and girls? > I'm using the python-framework BeautifulSoup(BS) to parse some > information out of a german soccer-website. consider using lxml. http://codespeak.net/lxml >>> from lxml import html > I want to parse the article shown on the website.

Re: UTF-8 and stdin/stdout?

2008-05-28 Thread Martin v. Löwis
> $ cat utf8_from_stdin.py > import sys > data = sys.stdin.read() > print "length of data =", len(data) sys.stdin is a byte stream in Python 2, not a character stream. To make it a character stream, do sys.stdin = codecs.getreader("utf-8")(sys.stdin) HTH, Martin -- http:/

Re: confused by HTMLParser class

2008-05-28 Thread Stefan Behnel
globalrev wrote: > tried all kinds of combos to get this to work. In case you meant to say that you can't get it to work, consider using lxml instead. http://codespeak.net/lxml http://codespeak.net/lxml/lxmlhtml.html Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Threads and import

2008-05-28 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: On May 28, 8:26 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: [EMAIL PROTECTED] schrieb: Hi, I'm trying to work out some strange (to me) behaviour that I see when running a python script in two different ways (I've inherited some code that needs to be maintaine

Re: php vs python

2008-05-28 Thread Paul Rubin
Jerry Stuckle <[EMAIL PROTECTED]> writes: > A good OO programmer could easily write good functional code. Over on #haskell there's a general belief that learning Haskell is easier for nonprogrammers than it is for OO programmers, since the OO programmers first have to unlearn what they previously

Re: looking for membership management software -- Open Source, written in Python

2008-05-28 Thread Rick Kwan
On May 27, 6:13 am, Laura Creighton <[EMAIL PROTECTED]> wrote: > In a message of Mon, 26 May 2008 12:38:28 PDT, [EMAIL PROTECTED] writes: > > >I forgot to ask: what's your target platform? I mentioned Organizer's > >Database, but it only runs on Windows. If you need a Linux or OS X > >solution, t

Re: Threads and import

2008-05-28 Thread rsoh . woodhouse
On May 28, 8:26 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] schrieb: > > > > > Hi, > > > I'm trying to work out some strange (to me) behaviour that I see when > > running a python script in two different ways (I've inherited some > > code that needs to be maintained and in

Re: Threads and import

2008-05-28 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: Hi, I'm trying to work out some strange (to me) behaviour that I see when running a python script in two different ways (I've inherited some code that needs to be maintained and integrated with another lump of code). The sample script is: # Sample script, simply creat

Re: accessing class attributes

2008-05-28 Thread giltay
On May 28, 12:09 pm, eliben <[EMAIL PROTECTED]> wrote: > Hello, > > I have a game class, and the game has a state. Seeing that Python has > no enumeration type, at first I used strings to represent states: > "paused", "running", etc. But such a representation has many > negatives, so I decided to l

Threads and import

2008-05-28 Thread rsoh . woodhouse
Hi, I'm trying to work out some strange (to me) behaviour that I see when running a python script in two different ways (I've inherited some code that needs to be maintained and integrated with another lump of code). The sample script is: # Sample script, simply create a new thread and run a # re

Re: Python and Flaming Thunder

2008-05-28 Thread Dan Upton
On Wed, May 28, 2008 at 11:09 AM, Dave Parker <[EMAIL PROTECTED]> wrote: >> > If catch(set x to y+z.) < 0.1 then go to tinyanswer. >> >> So what does this do exactly if the set throws an error? > > I think the catch should catch the error thrown by set, compare it to > 0.1, the comparison will not

Re: convert string number to real number - ValueError: invalid literal for int() with base 10: '"2"'

2008-05-28 Thread Matthias Bläsing
Am Wed, 28 May 2008 10:41:51 -0700 schrieb davidj411: > I like the str2num function approach, but then i get left with a float > that has more than 2 decimal spaces , i.e. 11.50 becomes > 11.449 and round will not fix that. Welcome to the wonderful world of floating point numbers. For

Re: while-loop?

2008-05-28 Thread Marc 'BlackJack' Rintsch
On Wed, 28 May 2008 19:56:55 +0200, huub wrote: > Being a newbie with Python, I'm trying a short program with this: > > > <..> >> t = RoboInterface() > > <..> >> while not t.Digital(1): # while endpoint is not reached >> 15 pass > > However, it always hangs on the 'while', which I can

Problem with subprocess and mkstemp

2008-05-28 Thread Hans Larsen
Hello, I'm having this script here: import sys, tempfile, subprocess if len(sys.argv) > 1: i = 0 while i < 1000: print "Hello World" * 500 i = i + 1 exit( 1 ) h,fp = tempfile.mkstemp() print "out: " + fp out = open(fp, "r") proc = subp

Re: Python and Flaming Thunder

2008-05-28 Thread Luis Zarrabeitia
On Wednesday 28 May 2008 09:22:53 am Dave Parker wrote: > I think in a month or two, Flaming Thunder will be using catch/throw > exception and error handling.  So, for example: Nice... Flaming Thunder sure evolves quickly. Too quickly to be considered a 'feature' of the language. Following your p

Re: Python Threads - stopped vs. gone vs. Alive

2008-05-28 Thread Francesco Bochicchio
On Wed, 28 May 2008 11:38:53 -0700, RossGK wrote: > > I've answered my own question about the "None" state - an event was > setting the thread to None where I didn't expect it. > > However, my question slightly repositioned is if a Thread is "Stopped" > it still seems to exist. Is there someway

Re: maximum recursion depth?

2008-05-28 Thread Sebastian 'lunar' Wiesner
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 [ Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> ] > On Wed, 28 May 2008 02:28:54 -0700, bearophileHUGS wrote: > >> Dennis Lee Bieber, the ghost: >>> I'd have to wonder why so many recursive calls? >> >> Why not? > > Because of the recursion limit of

while-loop?

2008-05-28 Thread huub
Hi, Being a newbie with Python, I'm trying a short program with this: > <..> t = RoboInterface() > <..> while not t.Digital(1): # while endpoint is not reached 15 pass However, it always hangs on the 'while', which I can't find in the tutorial at http://www.python.org/doc/. Assumi

Re: Struct usages in Python

2008-05-28 Thread Arnaud Delobelle
Arnaud Delobelle <[EMAIL PROTECTED]> writes: > "Alex Gusarov" <[EMAIL PROTECTED]> writes: > >>> class Event(object): >>> >>> Always subclass object, unless you have a very compelling reason not to, >>> or you are subclassing something else. >>> >> >> I've thought that if I write >> >> class Event

Re: Struct usages in Python

2008-05-28 Thread Arnaud Delobelle
"Alex Gusarov" <[EMAIL PROTECTED]> writes: >> class Event(object): >> >> Always subclass object, unless you have a very compelling reason not to, >> or you are subclassing something else. >> > > I've thought that if I write > > class Event: > pass > > , it'll be subclass of object too, I was

Re: Struct usages in Python

2008-05-28 Thread Diez B. Roggisch
Alex Gusarov schrieb: class Event(object): Always subclass object, unless you have a very compelling reason not to, or you are subclassing something else. I've thought that if I write class Event: pass , it'll be subclass of object too, I was wrong? Yes. That is the somewhat unfortu

Re: convert string number to real number - ValueError: invalid literal for int() with base 10: '"2"'

2008-05-28 Thread davidj411
On May 28, 2:22 am, Kam-Hung Soh <[EMAIL PROTECTED]> wrote: > David Jackson wrote: > > i used the csv module and saved its contents to a list. > > > ['Date', 'No.', 'Description', 'Debit', 'Credit'] > > ['3/17/2006', '5678', 'ELECTRONIC PAYMENT', '', '11.45'] > > ['3/04/2007', '5678', 'THE HOME DEP

Re: Python Threads - stopped vs. gone vs. Alive

2008-05-28 Thread RossGK
I've answered my own question about the "None" state - an event was setting the thread to None where I didn't expect it. However, my question slightly repositioned is if a Thread is "Stopped" it still seems to exist. Is there someway to make it go away, send it to garbage collection etc? Other p

Re: datetime.stdptime help

2008-05-28 Thread mblume
Am Tue, 27 May 2008 12:37:34 -0700 schrieb Dennis Lee Bieber: > > From the library reference: > """ > Support for the %Z directive is based on the values contained in tzname > and whether daylight is true. Because of this, it is platform-specific > except for recognizing UTC and GMT which ar

Re: Struct usages in Python

2008-05-28 Thread Alex Gusarov
> class Event(object): > > Always subclass object, unless you have a very compelling reason not to, > or you are subclassing something else. > I've thought that if I write class Event: pass , it'll be subclass of object too, I was wrong? -- Best regards, Alex Gusarov -- http://mail.python.

Re: definition of a highlevel language?

2008-05-28 Thread Stef Mientki
Avowkind wrote: On May 27, 6:34 am, [EMAIL PROTECTED] wrote: (might not be the right forum for this but...) what is the definition of a highlevel-language? well there isnt one specifically and wikipedia and the like gives just a very general description obv you can say it abstracts away low

Re: graphical ide??

2008-05-28 Thread Marc Pelletier
"Gabriel Genellina" <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > I'm unsure if you're looking for a development environment like these: > http://wiki.python.org/moin/IntegratedDevelopmentEnvironments > or an interface designer for wxPython (see the bottom part of > http://wiki.python.

Re: Overloading virtual method of widget without inheriting (PyQt)

2008-05-28 Thread Alex Gusarov
> I have a feeling that the form produced by Qt Designer, once converted to > code, contains references to QCalendarWidget where you really want to use a > customized calendar widget. If so, you should "promote" the calendar widget > in Qt Designer to use your widget instead, and make sure you impo

Problem using Idle under Linux - mouse not working well

2008-05-28 Thread Matthias Sommer
I have a strange problem using the python-Idle: I'm used to be able to position the cursor by clicking on the desired position. When I run Idle under Mandriva (or under Arch Linux as well) this does not work. Running under windows it works, running under Xandros linux on my eee pc it works to

Re: A video introducing Ulipad, an IDE mainly for Python

2008-05-28 Thread Dick Moores
Date: Wed, 28 May 2008 11:29:59 -0400 From: "Sean Azelton" <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Subject: Re: [Tutor] A video introducing Ulipad, an IDE mainly for Python For those looking for the codec and not running Windows, you can find it here for Mac OS X as well http://www.techsmith.

Re: accessing class attributes

2008-05-28 Thread Arnaud Delobelle
eliben <[EMAIL PROTECTED]> writes: > Hello, > > I have a game class, and the game has a state. Seeing that Python has > no enumeration type, at first I used strings to represent states: > "paused", "running", etc. But such a representation has many > negatives, so I decided to look at the Enum imp

Re: php vs python

2008-05-28 Thread Jerry Stuckle
[EMAIL PROTECTED] wrote: On May 28, 1:42 pm, Michael Fesser <[EMAIL PROTECTED]> wrote: .oO(Ivan Illarionov) No. Language does matter. And the weather. If you know how to program, you can write good code in any language if you're familiar enough with it. Many people write good code in PHP, an

Re: accessing class attributes

2008-05-28 Thread Gary Herron
eliben wrote: Hello, I have a game class, and the game has a state. Seeing that Python has no enumeration type, at first I used strings to represent states: "paused", "running", etc. But such a representation has many negatives, so I decided to look at the Enum implementation given here: http://

Re: Any way to loop through object variables?

2008-05-28 Thread Gary Herron
Dave Challis wrote: Hi, Just wondering if there's a way to iterate through all variables which an object has set? Specifically, I'm using the OptionParser module, which returns an options object, containing all command line options as object variables. I'd like to iterate over these rather than

accessing class attributes

2008-05-28 Thread eliben
Hello, I have a game class, and the game has a state. Seeing that Python has no enumeration type, at first I used strings to represent states: "paused", "running", etc. But such a representation has many negatives, so I decided to look at the Enum implementation given here: http://aspn.activestate

Any way to loop through object variables?

2008-05-28 Thread Dave Challis
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, Just wondering if there's a way to iterate through all variables which an object has set? Specifically, I'm using the OptionParser module, which returns an options object, containing all command line options as object variables. I'd like to itera

Re: Python Threads - stopped vs. gone vs. Alive

2008-05-28 Thread RossGK
On May 28, 12:01 pm, RossGK <[EMAIL PROTECTED]> wrote: > I'm a newbie to python threads, and playing with some simple client > server stuff and lots of print statements. > > My server thread launched with > self.worker = WorkerThread(self) > completes an interaction and then if I check on it's

Python Threads - stopped vs. gone vs. Alive

2008-05-28 Thread RossGK
I'm a newbie to python threads, and playing with some simple client server stuff and lots of print statements. My server thread launched with self.worker = WorkerThread(self) completes an interaction and then if I check on it's status with print "Status:", self.workerI get

Re: ctypes, function pointers and a lot of trouble

2008-05-28 Thread Nick Craig-Wood
Matt <[EMAIL PROTECTED]> wrote: > Okay so well, I have quite a problem right now with a file stream. What > I am doing is to use the Cannon SDK dlls to get control over my old > Cannon A60 Camera for some surveillance useage. > > By using ctypes it all worked well until now. I am able to loa

Re: BadStatusLine error

2008-05-28 Thread Diez B. Roggisch
Jim wrote: > Hi > > I get a BadStatusLine error (indicated below). Can anyone help with > how to > catch error in code before abort? http://docs.python.org/tut/node10.html Diez -- http://mail.python.org/mailman/listinfo/python-list

BadStatusLine error

2008-05-28 Thread Jim
Hi I get a BadStatusLine error (indicated below). Can anyone help with how to catch error in code before abort? Thanks Jim Traceback (most recent call last): File "C:\Python25\Lib\site-packages\pythonwin\pywin\framework \scriptutils.py", line 310, in RunScript exec codeObject in __main__.

pydb remote debugging/cmd.Cmd over socket?

2008-05-28 Thread Diez B. Roggisch
Hi, I'm fiddling around with pydb. Installation and usage are fine. What I especially like is the fact that you can attach a signal such that you drop into debugging mode on demand. But this is of limited use to me in situations where a server is written in python. According to the source, pydb's

Re: definition of a highlevel language?

2008-05-28 Thread Robert Brown
"inhahe" <[EMAIL PROTECTED]> writes: > I like to think of a language that would combine low-level and high-level > features to be used at the programmer's whim. C--, High Level Assembly, and > C++ with in-line assembly are examples, but none of them come as high-level > as Python. Other possib

Re: Python and Flaming Thunder

2008-05-28 Thread Dave Parker
> > If catch(set x to y+z.) < 0.1 then go to tinyanswer. > > So what does this do exactly if the set throws an error? I think the catch should catch the error thrown by set, compare it to 0.1, the comparison will not return true because the error is not less than 0.1, and so the go-to to tinyanswe

Using PEFile to replace Images in PE EXE

2008-05-28 Thread GeoffreyF67
I am trying to script some image changes for multiple EXE files in linux. The problem I'm running across is that I haven't been able to find anything out there that can do this...until now. It *looks* like pefile (available at google code) would do the trick. Unfortunately I know absolutely noth

A video introducing Ulipad, an IDE mainly for Python

2008-05-28 Thread Dick Moores
I've been using Ulipad, a free IDE mainly for Python, and written in wxPython, for a couple of years, and think it's terrific. Now another user, Kelie Feng, has made an 8-minute video showing it off. The visual clarity of the video is remarkable. You can download it (Introducing_Ulipad_2008-05-

Re: php vs python

2008-05-28 Thread Ivan Illarionov
On Wed, 28 May 2008 06:04:54 +, Tim Roberts wrote: > Ivan Illarionov <[EMAIL PROTECTED]> wrote: >>On Wed, 28 May 2008 05:10:20 +0400, AnrDaemon wrote: >>> In reply to Your message dated Monday, May 26, 2008, 04:47:00, >>> > As I've said before - good programmers can write good code in any

Re: Struct usages in Python

2008-05-28 Thread J. Cliff Dyer
On Wed, 2008-05-28 at 09:31 -0400, Alok Kumar wrote: > I am getting following error when tried as you suggested. > > self.event = [] #Create an empty list, bind to the name "event" under > the "self" namespace >self.event.append(Event()) #Create an event object and > append to the e

Re: Does this path exist?

2008-05-28 Thread Chris Hulan
On May 28, 4:59 am, [EMAIL PROTECTED] wrote: > On May 28, 3:47 am, Matt Nordhoff <[EMAIL PROTECTED]> wrote: ... > Thanks. So if OSError().errno == errno.ENOENT, then it means the path > doesn't exist? (What does "ENOENT" stan for?) I always read it as Error NO ENTry -- http://mail.python.org/mailm

Re: php vs python

2008-05-28 Thread cokofreedom
On May 28, 1:42 pm, Michael Fesser <[EMAIL PROTECTED]> wrote: > .oO(Ivan Illarionov) > > >No. Language does matter. > > And the weather. > > If you know how to program, you can write good code in any language if > you're familiar enough with it. Many people write good code in PHP, and > many write

Using an object-relational mapper to convert between databases

2008-05-28 Thread Ben Sizer
Hello, I'd like to be able to do the following: - open a connection to a MySQL or PostgreSQL database - read the schema and contents for one or more tables - create a new sqlite database file and open a connection to it - write out the previously-read tables and their contents to this new dat

Re: Error handling in Python

2008-05-28 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > Dear Members of the group, > If I open a url by urlopen in the urllib, the file is either opening a > file or if no url is there it would give error. The error is generated > can be handled by IOError handling schemes. > But if there are thousands or millions of URLs and

Re: Flash Decoder

2008-05-28 Thread Max Erickson
"Mathieu Prevot" <[EMAIL PROTECTED]> wrote: > 2008/5/28 Diez B. Roggisch <[EMAIL PROTECTED]>: >> Ankit wrote: >> >>> Hi everyone,i wanted to build a flash decoder using python can >>> somebody tell me which library to use and what steps should i >>> follow to make a flash(video) decoder?By a decod

Error handling in Python

2008-05-28 Thread subhabrata . iisc
Dear Members of the group, If I open a url by urlopen in the urllib, the file is either opening a file or if no url is there it would give error. The error is generated can be handled by IOError handling schemes. But if there are thousands or millions of URLs and I do not know who will open and who

Re: Python and Flaming Thunder

2008-05-28 Thread Duncan Booth
Dave Parker <[EMAIL PROTECTED]> wrote: > Catch also gives you a > single, uniform, syntactically unambiguous way to embed statements (or > whole statement lists) into expressions -- without causing the > syntactic problems of = statements in if statements or the obfuscation > of question mark nota

Re: multi dimensional dictionary

2008-05-28 Thread Paul McGuire
On May 28, 3:11 am, Peter Otten <[EMAIL PROTECTED]> wrote: > Gary Herron wrote: > > Alok Kumar wrote: > >> Dear All, > > >> I am using dictionary for filling my xpath parsed data. > > >> I wanted to use in the following manner. > > >> mydict[index] ["key1"] ["key2"]    #Can someone help me with rig

ctypes, function pointers and a lot of trouble

2008-05-28 Thread Matt
Hi friends, Okay so well, I have quite a problem right now with a file stream. What I am doing is to use the Cannon SDK dlls to get control over my old Cannon A60 Camera for some surveillance useage. By using ctypes it all worked well until now. I am able to load the dlls, use a lot of funct

Re: Struct usages in Python

2008-05-28 Thread Alok Kumar
I am getting following error when tried as you suggested. self.event = [] #Create an empty list, bind to the name "event" under the "self" namespace self.event.append(Event()) #Create an event object and append to the end of the list *class Event(): ^ SyntaxError: in

Re: Python and Flaming Thunder

2008-05-28 Thread Dave Parker
> That error message is the erlang interpreter saying "Hey I know X is > 8, and you've said it is 10 - that can't be right", which is pretty > much what math teachers say too... I enjoyed the discussion of how different languages handle the notion of "="; I learned something new. Thanks. On May

Re: Python and Flaming Thunder

2008-05-28 Thread Dave Parker
> Does this mean that Flaming Thunder requires explicit checking rather > than offering exceptions? Right now, yes, Flaming Thunder has minimal error handling. But error handling is rising on the list of priorities for the next few weeks (arrays, matrices, and 3D graphics are the hightest). I th

Re: Flash Decoder

2008-05-28 Thread Mathieu Prevot
2008/5/28 ankit anand <[EMAIL PROTECTED]>: > hmm i am more interested in .swf format and more specifically i would like > to have all the pixel values of all the frames can i do that using this > library? Not with ffmpeg. You can check out the code from Gnash [1] or Swfdec [2] or start you swf dec

Re: Simple Doc Test failing without any reason [Help Needed]

2008-05-28 Thread afrobeard
I copied the text off here into a new file and it worked!. I then took a diff between the version that didnt work and the version that worked and the only difference was a couple of spaces after this line:- >>> sanitize_number('0321-4683113')>> brackets> Apparently they caused the test case to f

Re: Struct usages in Python

2008-05-28 Thread Alok Kumar
while traversing I get out of index error as mentioned below. class EventTimeFilter: def __init__(self): * self.event = [Event()]* def populateScheduleData(self): self.doc = libxml2.parseFile(self.FILENAME) for eachcamera in self.doc.xpathEval('SetDeviceConfigura

Re: Simple Doc Test failing without any reason [Help Needed]

2008-05-28 Thread Gerard Flanagan
On May 28, 1:48 pm, afrobeard <[EMAIL PROTECTED]> wrote: > The following following code fails with the failiure:- > > File "test.py", line 27, in __main__.sanitize_number > Failed example: > sanitize_number('0321-4683113') > Expected: > '03214683113' > Got: > '03214683113' > > Expected

  1   2   >