Re: Translating pysnmp oids to human readable strings

2009-03-07 Thread rdmurray
SpamMePlease PleasePlease spankthes...@googlemail.com wrote: On Fri, Mar 6, 2009 at 2:14 PM, Shantanu Joshi weemadart...@gmail.com wrote: SpamMePlease PleasePlease spankthes...@googlemail.com writes: I actually tried to load the new file with following code: print

Re: question about ctrl-d and atexit with threads

2009-03-06 Thread rdmurray
Darren Dale dsdal...@gmail.com wrote: On Mar 5, 6:27 pm, Gabriel Genellina gagsl-...@yahoo.com.ar wrote: En Thu, 05 Mar 2009 15:26:18 -0200, Darren Dale dsdal...@gmail.com escribi�: On Mar 5, 12:02�pm, s...@pobox.com wrote: What happens if you simply call

RE: Help required to read and print lines based on the type of first character

2009-03-05 Thread rdmurray
abhinayaraj.r...@emulex.com wrote: Thank you for the suggestions. Some little reading gave the idea and it works well too. :) Here is the code: fileIN = open(test.txt) count = 0 for line in fileIN: data= line if '' in data: count = 4 elif '###'

Is it possible to grab hidden code in ClientForm?

2009-03-01 Thread rdmurray
Muddy Coder cosmo_gene...@yahoo.com wrote: Nowadays some websites let users to fill in some so-called verification code, and the tricky thing is that the CODE is delivered from server with an image. For example: img src=/jobsearch/captcha.jpg name=CAPTCHA_IMAGE border=1 / nbsp;nbsp;a href=#

Re: why cannot assign to function call

2009-02-28 Thread rdmurray
Mark Wooding m...@distorted.org.uk wrote: Ethan Furman et...@stoneleaf.us writes: Mark Wooding wrote: Here's what I think is the defining property of pass-by-value [...]: The callee's parameters are /new variables/, initialized /as if by assignment/ from the values of caller's

TypeErrors

2009-02-28 Thread rdmurray
Sean Novick daddysea...@yahoo.com wrote: First lookup: Traceback (most recent call last): File F:\CSC113 Module 4 CA\sample database.py, line 72, in module class phonedb: File F:\CSC113 Module 4 CA\sample database.py, line 146, in phonedb

OTish: convince the team to drop VBScript

2009-02-28 Thread rdmurray
Christian R. pafbo...@gmail.com wrote: The company does use Python on rare occasions. It all comes down to the prejudices and habits of one of the programmers. His only argument I can't counter -because I don't see the problem- is that Python modules cause problems for updates to customer's

Re: How best to test functions which use date.today

2009-02-28 Thread rdmurray
Christian Heimes li...@cheimes.de wrote: Lie Ryan wrote: But this fails with: TypeError: can't set attributes of built-in/extension type 'datetime.date' This is because today is an attribute. In python, we can override attribute access to become a function call. I don't have python

Re: Creating Zip file like java jar file

2009-02-28 Thread rdmurray
zaheer.ag...@gmail.com wrote: On Feb 28, 11:33 pm, Lie Ryan lie.1...@gmail.com wrote: zaheer.ag...@gmail.com wrote: On Feb 28, 11:15 pm, Gabriel Genellina gagsl-...@yahoo.com.ar wrote: En Sat, 28 Feb 2009 14:34:15 -0200, zaheer.ag...@gmail.com escribi= =F3: I want to create zip

Efficient searching through objects

2009-02-26 Thread rdmurray
sert je...@hotmail.com wrote: I have written a program that reads data and updates the records for some people. They are represented by objects, and I need to read the data from a file, look the person up and then update his record. I have implemented this by creating a list with all the

Re: How do I decode unicode characters in the subject using email.message_from_string()?

2009-02-25 Thread rdmurray
John Machin sjmac...@lexicon.net wrote: On Feb 25, 11:07=A0am, Roy H. Han starsareblueandfara...@gmail.com wrote: Dear python-list, I'm having some trouble decoding an email header using the standard imaplib.IMAP4 class and email.message_from_string method. In particular,

Re: How do I decode unicode characters in the subject using email.message_from_string()?

2009-02-25 Thread rdmurray
Steve Holden st...@holdenweb.com wrote: from email.header import decode_header print decode_header(=?us-ascii?Q?Inteum_C/SR_User_Tip:__Quick_Access_to_Recently_Opened_Inteu?=\r\n\t=?us-ascii?Q?m_C/SR_Records?=) [('Inteum C/SR User Tip: Quick Access to Recently Opened Inteum C/SR Records',

Re: How do I decode unicode characters in the subject using email.message_from_string()?

2009-02-25 Thread rdmurray
Steve Holden st...@holdenweb.com wrote: rdmur...@bitdance.com wrote: Steve Holden st...@holdenweb.com wrote: from email.header import decode_header print decode_header(=?us-ascii?Q?Inteum_C/SR_User_Tip:__Quick_Access_to_Recently_Opened_Inteu?=\r\n\t=?us-ascii?Q?m_C/SR_Records?=)

Re: can error messages be improved or can they be overridden ?

2009-02-23 Thread rdmurray
Stef Mientki stef.mien...@gmail.com wrote: thanks Ron, but I was looking for a more general solution, in which I don't change the program itself, and where the error messages (in general) become more informative than it is by default. [snip] -Original Message- From: Stef

read csv error question

2009-02-23 Thread rdmurray
Vincent Davis vinc...@vincentdavis.net wrote: I am trying to read a csv file from excel on a mac. I get the following error.SystemExit: file some.csv, line 1: new-line character seen in unquoted field - do you need to open the file in universal-newline mode? I was using the example code

Re: can error messages be improved or can they be overridden ?

2009-02-23 Thread rdmurray
andrew cooke and...@acooke.org wrote: rdmur...@bitdance.com wrote: [...] (You know, I really ought to revisit that routine and make it part of my standard development toolbox.) please post it OK. I dug it up, cut out the stuff that was specific to the application, freshened it up a

Re: Find the location of a loaded module

2009-02-21 Thread rdmurray
Gabriel Genellina gagsl-...@yahoo.com.ar wrote: En Fri, 20 Feb 2009 20:44:21 -0200, Aaron Scott aaron.hildebra...@gmail.com escribi=F3: So, the problem lies with how Python cached the modules in memory. Yes, the modules were in two different locations and yes, the one that I specified

Re: Pythonic way to determine if one char of many in a string

2009-02-21 Thread rdmurray
odeits ode...@gmail.com wrote: On Feb 21, 12:47=A0am, Gabriel Genellina gagsl-...@yahoo.com.ar wrote: En Sat, 21 Feb 2009 01:14:02 -0200, odeits ode...@gmail.com escribi=F3: On Feb 15, 11:31=A0pm, odeits ode...@gmail.com wrote: It seems what you are actually testing for is if the

Re: Maximum recursion depth exceeded...why?

2009-02-18 Thread rdmurray
alex23 wuwe...@gmail.com wrote: On Feb 18, 11:36=A0am, Paul Rubin http://phr...@nospam.invalid wrote: Thomas Allen thomasmal...@gmail.com writes: attempting. Basically, I'm transforming a live site to a local one and Something wrong with wget -R ? Did you mean wget -r ? That will

Re: Maximum recursion depth exceeded...why?

2009-02-18 Thread rdmurray
Thomas Allen thomasmal...@gmail.com wrote: On Feb 18, 4:51 am, alex23 wuwe...@gmail.com wrote: On Feb 18, 7:34 pm, rdmur...@bitdance.com wrote: Yeah, but wget -r -k will do that bit of it, too. Wow, nice, I don't know why I never noticed that. Cheers! Hm...doesn't do that over here.

Re: hpw to convert a linux python script ?

2009-02-11 Thread rdmurray
Stef Mientki stef.mien...@gmail.com wrote: Alec Schueler wrote: On Feb 11, 7:58 pm, Stef Mientki stef.mien...@gmail.com wrote: As there are a whole lot of these lines, in a whole lot of files, I wonder if there's a simple trick to point /usr/share/tinybldLin/ to my directory ?

Re: Import without executing module

2009-02-10 Thread rdmurray
Lie Ryan lie.1...@gmail.com wrote: On Tue, 03 Feb 2009 20:08:34 -0800, Stephen Hansen wrote: There is no need to try to make sure something is executed/compiled only once in Python like you may want to do in C. Every module is only ever compiled once: if you import it ten times in ten

Can urllib check path exists on server?

2009-02-10 Thread rdmurray
Muddy Coder cosmo_gene...@yahoo.com wrote: urllib bridges up a client to a server, it works fine. I wonder: is there a method that can check the existence of a file in the server side? We can check such an existence on local filesystem by using os.path.exists(), can I do such a check on

Re: what IDE is the best to write python?

2009-02-10 Thread rdmurray
a...@pythoncraft.com (Aahz) wrote: In article mailman.8714.1233686338.3487.python-l...@python.org, rdmur...@bitdance.com wrote: Quoth a...@pythoncraft.com (Aahz): Then I have the problem of copying around the syntax highlighting configuration to every computer I use. Well, _that's_ easy

Help needed to retrieve text from a text-file using RegEx

2009-02-09 Thread rdmurray
Oltmans rolf.oltm...@gmail.com wrote: Here is the scenario: It's a command line program. I ask user for a input string. Based on that input string I retrieve text from a text file. My text file looks like following Text-file: -

urllib2: problem of handling space in parameter

2009-02-07 Thread rdmurray
Quoth Muddy Coder cosmo_gene...@yahoo.com: Hi Folks, I encrountered a problem of using urllib2: the space handling. Look at the code below: import urllib2 url = r'http://somedomain.com/a.cgi?name=muddy coderpassword=foobar cgi_back = urllib2.urlopen(url).read() In this cgi_back, I saw

Re: Flattening lists

2009-02-07 Thread rdmurray
Rhamphoryncus rha...@gmail.com wrote: On Feb 6, 10:21=A0pm, rdmur...@bitdance.com wrote: Quoth Mensanator mensana...@aol.com: def flatten(listOfLists): =A0 =A0 return list(chain.from_iterable(listOfLists)) =A0 =A0 Python 2.6.1 (r261:67515, Jan =A07 2009, 17:09:13) =A0 =A0 [GCC

isfifo?

2009-02-07 Thread rdmurray
I've googled and looked through os.path, but I don't see a method for determining if a path points to a FIFO. Anyone know of a simple way to do so? --RDM -- http://mail.python.org/mailman/listinfo/python-list

Re: isfifo?

2009-02-07 Thread rdmurray
=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?= mar...@v.loewis.de wrote: rdmur...@bitdance.com wrote: I've googled and looked through os.path, but I don't see a method for determining if a path points to a FIFO. Anyone know of a simple way to do so? def isfifo(fn): return

Trouble sorting a list of objects by attributes

2009-02-06 Thread rdmurray
Quoth Robocop btha...@physics.ucsd.edu: Hello again, I've found myself stumped when trying to organize this list of objects. The objects in question are timesheets which i'd like to sort by four attributes: class TimeSheet: department = string engagement = string date =

Re: Flattening lists

2009-02-06 Thread rdmurray
Quoth Mensanator mensana...@aol.com: On Feb 6, 3:23=A0pm, Rhamphoryncus rha...@gmail.com wrote: On Feb 5, 1:16=A0pm, Michele Simionato michele.simion...@gmail.com wrote: On Feb 5, 7:24=A0pm, a...@pythoncraft.com (Aahz) wrote: In article

string replace for back slash

2009-02-05 Thread rdmurray
S.Selvam Siva s.selvams...@gmail.com wrote: I tried to do a string replace as follows, s=hi people s.replace(,\) 'hi \\ people' but i was expecting 'hi \ people'.I dont know ,what is something different here with escape sequence. You are running into the difference between the

Re: Python 3.0 slow file IO

2009-02-05 Thread rdmurray
Quoth Christian Heimes li...@cheimes.de: thomasvang...@gmail.com schrieb: I just recently learned python, I'm using it mainly to process huge 5GB txt files of ASCII information about DNA. I've decided to learn 3.0, but maybe I need to step back to 2.6? I'm getting exceedingly

os.system issues

2009-02-05 Thread rdmurray
Youri Lammers youri_lammers...@hotmail.com writes: I want to run a program called 'muscle' with my python script=2C muscle uses the following command: 'muscle.exe -in filename -out filename' so far I got: import os args = ['-in filename', '-out filename']

Re: Flattening lists

2009-02-05 Thread rdmurray
Baolong zhen netz...@gmail.com wrote: On Thu, Feb 5, 2009 at 10:17 PM, mk mrk...@gmail.com wrote: Brian Allen Vanderburg II wrote: def flatten(x): res = [] for el in x: if isinstance(el,list): res.extend(flatten(el)) else:

Re: Flattening lists

2009-02-05 Thread rdmurray
Quoth rdmur...@bitdance.com: This is all premature optimization, except for the goopy code, which is presumably used enough to make it worth optimizing. And guess what? The goopy code wins. What the people theorizing about the speed of extend vs list creation miss is that the things with

Re: Flattening lists

2009-02-05 Thread rdmurray
Quoth J Kenneth King ja...@agentultra.com: mk mrk...@gmail.com writes: Hello everybody, Any better solution than this? def flatten(x): res = [] for el in x: if isinstance(el,list): res.extend(flatten(el)) else: res.append(el)

Couple of noobish question

2009-02-04 Thread rdmurray
Quoth Catherine Heathcote catherine.heathc...@gmail.com: all goes well. I have an idea for a small project, an overly simplistic interactive fiction engine (well more like those old choose your own adventure books, used to love those!) that uses XML for its map files. The main issues I see

Re: Python Global State

2009-02-03 Thread rdmurray
Quoth MRAB goo...@mrabarnett.plus.com: er wrote: Simple question, I think: Is there a way to make a completely global variable across a slew of modules? If not, what is the canonical way to keep a global state? The purpose of this is to try to prevent circular module imports, which just

Re: what IDE is the best to write python?

2009-02-03 Thread rdmurray
Quoth a...@pythoncraft.com (Aahz): In article mpg.23f220f22aa48ce9989...@news.individual.de, Thorsten Kampe thors...@thorstenkampe.de wrote: * Aahz (2 Feb 2009 09:29:43 -0800) In article mpg.23f146877dac7c30989...@news.individual.de, Thorsten Kampe thors...@thorstenkampe.de wrote: * Aahz

Re: is python Object oriented??

2009-02-03 Thread rdmurray
Quoth David Cournapeau courn...@gmail.com: On Wed, Feb 4, 2009 at 2:36 AM, thmpsn@gmail.com wrote: Pretty much, unless maybe the code documents what you're not supposed to access: But that's my point: that's just not true for many packages I have used - some packages do follow the

global variable confusion

2009-02-03 Thread rdmurray
Robert D.M. Smith robert.dm.sm...@gmail.com wrote: I have a question on global variables and how to use them. I have 2 files; a.py b.py # a.py - myvar = { 'test' : '123' } # --- # b.py - from a import myvar def test(): a.myvar = { 'blah' : '456' } # -

Re: Passing environment variable to subprocess causes failure

2009-02-03 Thread rdmurray
Quoth MRAB goo...@mrabarnett.plus.com: davidgo...@davidgould.com wrote: I'm attempting to run subprocess and passing in an environment variable. When I do this the child process fails with an error. When I don't pass an environement variable it runs fine. BTW Running this code

Re: Extracting file from zip archive in Python 2.6.1

2009-02-03 Thread rdmurray
Quoth Brandon Taylor btaylordes...@gmail.com: Ok, the first thing I needed to do was add: from __future__ import with_statement at the beginning of my file but: with zip_file.open(zip_name + '/' + thumbnail_image) as source: with open(os.path.join(thumbnail_path,

Re: is python Object oriented??

2009-02-02 Thread rdmurray
Quoth Hendrik van Rooyen m...@microcorp.co.za: rd.mur...@bitdance.com wrote: You, sir, should be programming in some language other than Python. Why? - Python is object oriented, but I can write whole systems without defining a single class. By analogy, if data hiding is added to

Re: What is wrong in my list comprehension?

2009-02-02 Thread rdmurray
Quoth Stephen Hansen apt.shan...@gmail.com: I just think at this point .find is just not the right method to use; substring in string is the way to determine what he wants is all. .find is useful for when you want the actual position, not when you just want to determine if there's a match at

Combining several text files

2009-02-02 Thread rdmurray
Quoth Eric eric.sh...@gmail.com: This is my first post, so please advise if I'm not using proper etiquette. I've actually searched around a bit and while I think I can do this, I can't think of a clean elegant way. I'm pretty new to Python, but from what I've learned so far is that there is

Re: is python Object oriented??

2009-02-02 Thread rdmurray
Quoth Hendrik van Rooyen m...@microcorp.co.za: Now there are a LOT of dicey statements in the above passionate plea - python is a language, and not a philosophy, but I won't go into that, as that would lead off onto a tangent, of which there have been a surfeit in this thread. Ah, now I

Re: Membership of multiple items to a list

2009-02-02 Thread rdmurray
My client can handle your Mime and shows me the text part of the signed message. It's not as pretty as just seeing an unsigned text message, but that's a client problem, not yours :) I would like to think that all newsreader clients could handle mime at this point, but who knows. --RDM --

Re: is python Object oriented??

2009-02-01 Thread rdmurray
Quoth thmpsn@gmail.com: Anyway, it doesn't matter. We're losing the point here. The point is that language support for private access, by disallowing user access to private data, provides an unambiguous information hiding mechanism which encourages encapsulation. Python's approach,

Problem with slow httplib connections on Windows (and maybe other platforms)

2009-02-01 Thread rdmurray
Quoth Christoph Zwerschke c...@online.de: What actually happens is the following: * BaseHTTPServer binds only to the IPv4 address of localhost, because it's based on TCPServer which has address_family=AF_INET by default. * HTTPConnection.connect() however tries to connect to all IP

Re: Problem with slow httplib connections on Windows (and maybe other platforms)

2009-02-01 Thread rdmurray
Quoth Christoph Zwerschke c...@online.de: rdmur...@bitdance.com schrieb: Quoth Christoph Zwerschke c...@online.de: With Py 2.3 (without IPv6 support) this is only the IPv4 address, but with Py 2.4-2.6 the order is (on my Win XP host) the IPv6 address first, then the IPv4 address.

Re: Membership of multiple items to a list

2009-02-01 Thread rdmurray
Quoth Steven D'Aprano ste...@remove.this.cybersource.com.au: On Sun, 01 Feb 2009 12:01:11 -0800, Stephen Hansen wrote: brdiv class=gmail_quoteblockquote class=gmail_quote style=border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;br I'd like to know how

Re: glob.fnmatch (was search speed)

2009-01-31 Thread rdmurray
Quoth Tim Chase python.l...@tim.thechases.com: rdmur...@bitdance.com wrote: What you want is: from fnmatch import fnmatch Oh, that's head-smackingly obvious now...thanks! My thought process usually goes something like I want to do some file-name globbing there's a glob

Re: SimpleXMLRPCServer question

2009-01-31 Thread rdmurray
Quoth flagg ianand0...@gmail.com: Let me see if i can elaborate on the requirements. I have 20+ different zone files. I want the xmlrpc server to be able to determine what zone file to open by looking at the incoming xml request. For example one of the functions I have now is to show a DNS

Re: verilog like class w/ bitslicing int/long classtype

2009-01-30 Thread rdmurray
Quoth Stef Mientki stef.mien...@gmail.com: Marc 'BlackJack' Rintsch wrote: On Fri, 30 Jan 2009 00:25:03 +0100, Stef Mientki wrote: try this: class MyRegClass ( int ) : def __init__ ( self, value ) : self.Value = value def __repr__ ( self ) : line = hex (

Re: Importing modules

2009-01-30 Thread rdmurray
Quoth Mudcat mnati...@gmail.com: [attribution omitted by Mudcat] I think you've probably had issues with circular imports (i.e. mutual dependencies), unless you can precisely remember what you were doing and what went wrong. That's possible, but circular imports become more of a hazard if

SimpleXMLRPCServer question

2009-01-30 Thread rdmurray
Quoth flagg ianand0...@gmail.com: I am working on a very basic xmlrpc server, which will expose certain functions for administering BIND zone files. The big problem I am having is parsing the incoming xmlrpc request. Basically part of the xmlrpc request will help deterime which zone file is

Re: More mod_wsgi weirdness: process restarts on redirect

2009-01-30 Thread rdmurray
Quoth Ron Garret rnospa...@flownet.com: In article mailman.8321.1233272610.3487.python-l...@python.org, Joshua Kugler jos...@joshuakugler.com wrote: Ron Garret wrote: My question is: is this supposed to be happening? Or is this an indication that something is wrong, and if so, what?

Re: search speed

2009-01-30 Thread rdmurray
Quoth Tim Chase t...@thechases.com: PS: as an aside, how do I import just the fnmatch function? I tried both of the following and neither worked: from glob.fnmatch import fnmatch from glob import fnmatch.fnmatch I finally resorted to the contortion coded below in favor of

Re: ANN: New Book: Programming in Python 3

2008-12-19 Thread rdmurray
Quoth Steven D'Aprano st...@remove-this-cybersource.com.au: The second exception is if the word ends with an S. In British English, you put the apostrophe after the S: Thomas' approach is wholly practical. In American English, they often (but not always) add an extra S: Thomas's approach is

Re: New Python 3.0 string formatting - really necessary?

2008-12-19 Thread rdmurray
Quoth Steven D'Aprano st...@remove-this-cybersource.com.au: Whether using % or format(), I don't see the need to change the code, only the strings. Using positional arguments is not really that different: {0} {1}.format(dead, parrot) {0} {1}.format(perroquet, mort) This should be

Re: confused about __str__ vs. __repr__

2008-12-18 Thread rdmurray
Quoth Diez B. Roggisch de...@nospam.web.de: Neal Becker wrote: Tino Wildenhain wrote: Neal Becker wrote: ... That makes no sense to me. If I call 'print' on a container, why wouldn't it recursively print on the contained objects? Since print means call str, printing a

Why no lexical scoping for a method within a class?

2008-12-17 Thread rdmurray
Quoth walterbyrd walterb...@iname.com: For a language as well structured as Python, this seems somewhat sloppy, and inconsistant. Or is there some good reason for this? Yes. It's called Object Oriented Programming. Here is what I mean: def a(): x = 99 print x def b():

Re: help I'm getting delimited

2008-12-17 Thread rdmurray
Quoth John Machin sjmac...@lexicon.net: On Dec 18, 1:28 am, aka alexoploca...@gmail.com wrote: @expose(allow_json=True) Means what? Does what? Does the problem still happen without that? Means what he's posting is not a standalone script :) He says it's part of his turbogears ap.

Re: getting object instead of string from dir()

2008-12-17 Thread rdmurray
Quoth Rominsky john.romin...@gmail.com: vars seems to give an identical response as locals and globals, at least in my test name space. All three are new commands for me. I Without arguments vars() returns the same thing as locals(). like the idea of adopting either vars or locals instead

Re: Generator slower than iterator?

2008-12-16 Thread rdmurray
Quoth Lie Ryan lie.1...@gmail.com: On Tue, 16 Dec 2008 12:07:14 -0300, Federico Moreira wrote: Hi all, Im parsing a 4.1GB apache log to have stats about how many times an ip request something from the server. The first design of the algorithm was for line in

eval() and global variables

2008-12-16 Thread rdmurray
Quoth =?ISO-8859-1?Q?Juan_Pablo_Romero_M=E9ndez?= jpablo.rom...@gmail.com: Hello, Suppose this function is given: def f(x,y): return x+y+k Is it possible to somehow assign a value to k without resorting to making k global? I'm thinking something like this: eval(f(1,1), {f:f,

Re: Having Issues with CMD and the 'python' command

2008-12-15 Thread rdmurray
On Mon, 15 Dec 2008 at 23:01, James Mills wrote: On Mon, Dec 15, 2008 at 10:51 PM, Lamonte Harris pyth0nc0...@gmail.com wrote: Every time I start cmd on windows it requires me to set path=%path%;C:\python26 why? I'm getting annoyed... cmd has _nothing_ to do with Python. (Top posting

Re: %s place holder does not let me insert ' in an sql query with python.

2008-12-15 Thread rdmurray
On Mon, 15 Dec 2008 at 18:16, Krishnakant wrote: how do you let the ' go as a part of the string? I have used %s as placeholder as in queryString = insert into venders values ('%s,%s,%s % (field1,field2,field3 ) ... This is not working for the ' values. This is untested, but I think what you

Re: subprocess to pipe through several processes?

2008-12-14 Thread rdmurray
On Sat, 13 Dec 2008 at 23:05, Neal Becker wrote: How would I use suprocess to do the equivalent of: cat - | program_a | program_b Have you tried extending the pipe example from the manual? http://docs.python.org/library/subprocess.html#replacing-shell-pipeline --David --

Re: Shorter tracebacks

2008-12-13 Thread rdmurray
On Sat, 13 Dec 2008 at 06:13, bearophileh...@lycos.com wrote: When I write recursive code in Python I sometimes go past the maximum allowed stack depth, so I receive a really long traceback. The show of such traceback on my screen is very slow (despite a CPU able to perform billions of

Re: Interface Implementation

2008-12-12 Thread rdmurray
On Fri, 12 Dec 2008 at 16:07, J Ramesh Kumar wrote: I am new to python. I require some help on implementing interface and its implementation. I could not find any sample code in the web. Can you please send me some sample code which is similar to the below java code ? Thanks in advance for your

Re: Preventing execution of a method

2008-12-11 Thread rdmurray
On Thu, 11 Dec 2008 at 08:16, alex23 wrote: On Dec 12, 2:07?am, Emanuele D'Arrigo [EMAIL PROTECTED] wrote: I.e. if I have a class with two methods, doSomethingSafe() and doSomethingDangerous(), is there a way to prevent another module from executing doSomethingDangerous() but allow the

Re: newbie question: if var1 == var2:

2008-12-11 Thread rdmurray
On Thu, 11 Dec 2008 at 10:24, Kirk Strauser wrote: At 2008-11-29T04:02:11Z, Mel [EMAIL PROTECTED] writes: You could try for item in fname: item = item.strip() This is one case where I really miss Perl's chomp function. It removes a trailing newline and nothing else, so you don't have

Re: internal circular class references

2008-12-11 Thread rdmurray
On Thu, 11 Dec 2008 at 09:33, Ethan Furman wrote: Carl Banks wrote: On Dec 10, 5:26 pm, Ethan Furman et...@stoneleaf.us wrote: First of all, do you even need to wrap the datetime.date class? With Python's duck typing ability, you could have a separate NullDate class to go alongside the

Re: Preventing execution of a method

2008-12-11 Thread rdmurray
On Thu, 11 Dec 2008 at 13:41, Emanuele D'Arrigo wrote: On Dec 11, 7:48?pm, Bruno Desthuilliers bdesth.quelquech...@free.quelquepart.fr wrote: or to provide read-only access. I.e. right now I'm working on the graphical client which potentially could be rewritten entirely by the users. It is

Re: SequenceMatcher bug ?

2008-12-10 Thread rdmurray
On Tue, 9 Dec 2008 at 22:15, eliben wrote: On Dec 10, 4:12?am, [EMAIL PROTECTED] wrote: On Mon, 8 Dec 2008 at 23:46, eliben wrote: This is about Python 2.5.2 - I don't know if there were fixes to this module in 2.6/3.0 I think I ran into a bug with difflib.SequenceMatcherclass.

Re: forcing future re-import from with an imported module

2008-12-10 Thread rdmurray
On Wed, 10 Dec 2008 at 14:53, _wolf wrote: thanks for your answer. i am aware that imports are not designed to have side-effects, but this is exactly what i want: to trigger an action with `import foo`. you get foo, and doing this can have a side- effect for the module, in roughly the way that a

Re: Best way to report progress at fixed intervals

2008-12-09 Thread rdmurray
On Tue, 9 Dec 2008 at 08:40, Slaunger wrote: I am a novice Python 2.5 programmer, who write some cmd line scripts for processing large amounts of data. I would like to have possibility to regularly print out the progress made during the processing, say every 1 seconds, and i am wondering what a

Re: Can't figure out where SyntaxError: can not delete variable 'x' referenced in nested scope us coming from in python =2.6

2008-12-09 Thread rdmurray
On Tue, 9 Dec 2008 at 13:11, Albert Hopkins wrote: Say I have module foo.py: def a(x): def b(): x del x [...] The difference is under Python 2.4 I get a traceback with the lineno and offending line, but I do not get a traceback in Pythons 2.6 and 3.0.

Re: When (and why) to use del?

2008-12-09 Thread rdmurray
On Tue, 9 Dec 2008 at 18:55, Duncan Booth wrote: Albert Hopkins [EMAIL PROTECTED] wrote: def otherfunction(): try: # some stuff except SomeException, e: # more stuff del e return I think this looks

Re: Best way to report progress at fixed intervals

2008-12-09 Thread rdmurray
On Tue, 9 Dec 2008 at 13:27, Slaunger wrote: On 9 Dec., 19:35, [EMAIL PROTECTED] wrote: I felt like a little lunchtime challenge, so I wrote something that I think matches your spec, based on your sample code. ?This is not necessarily the best implementation, but I think it is simpler and

Re: SequenceMatcher bug ?

2008-12-09 Thread rdmurray
On Mon, 8 Dec 2008 at 23:46, eliben wrote: This is about Python 2.5.2 - I don't know if there were fixes to this module in 2.6/3.0 I think I ran into a bug with difflib.SequenceMatcher class. Specifically, its ratio() method. The following: SequenceMatcher(None, [4] + [10] * 500 + [5], [10] *

Re: Text parsing via regex

2008-12-09 Thread rdmurray
On Mon, 8 Dec 2008 at 16:51, Robert Kern wrote: Robocop wrote: Wow! Thanks for all the input, it looks like that textwrapper will work great for my needs. And thanks for the regex help everyone. Also, i was thinking of using a list, but i haven't used them much in python. Is there

Re: How do I manually uninstall setuptools (installed by egg)?

2008-12-09 Thread rdmurray
On Tue, 9 Dec 2008 at 18:49, [EMAIL PROTECTED] wrote: On Ubuntu, I accidentally manually installed setuptools http://pypi.python.org/pypi/setuptools/0.6c9 (by running the .egg file as a shell script via sudo), and now realize I should just be using apt to take care of my system Python packages.

Re: pretty strange behavior of strip

2008-12-05 Thread rdmurray
On Thu, 4 Dec 2008 at 20:54, Terry Reedy wrote: 'toc.html' test[4].strip('.html') 'oc' Can't figure out what is going on, really. What I can't figure out is why, when people cannot figure out what is going on with a function (or methods in this case), they do not look it up the doc.

Re: pretty strange behavior of strip

2008-12-05 Thread rdmurray
On Fri, 5 Dec 2008 at 07:54, Mark Tolonen wrote: import re re.split('[,.]','blah,blah.blah') ['blah', 'blah', 'blah'] Thank you. Somehow it never occurred to me that I could use that kind of pattern that way. I guess my brain just doesn't think in regexes very well :) --RDM --

Re: simplest way to strip a comment from the end of a line?

2008-12-04 Thread rdmurray
On Thu, 4 Dec 2008 at 08:50, Joe Strout wrote: I have lines in a config file which can end with a comment (delimited by # as in Python), but which may also contain string literals (delimited by double quotes). A comment delimiter within a string literal doesn't count. Is there any easy way

Re: Why shouldn't you put config options in py files

2008-12-04 Thread rdmurray
On Thu, 4 Dec 2008 at 11:35, HT wrote: I can think of lots of arguments why this is a bad idea, but I don't seem to be able to think of a really convincing one. I think it depends on the problem domain. As someone else said, there are issues with being able to inject arbitrary code via the