Re: What's the tidy/elegant way to protect this against null/empty parameters?

2012-10-16 Thread Jean-Michel Pichavant
- Original Message - I want to fix an error in some code I have installed, however I don't really want to just bodge it. The function producing the error is:- def get_text(self, idx): # override ! node = self.items[idx] a= [ ,

Re: What's the tidy/elegant way to protect this against null/empty parameters?

2012-10-16 Thread Marco Nawijn
On Monday, October 15, 2012 1:33:02 PM UTC+2, (unknown) wrote: I want to fix an error in some code I have installed, however I don't really want to just bodge it. The function producing the error is:- def get_text(self, idx): # override ! node =

Re: What's the tidy/elegant way to protect this against null/empty parameters?

2012-10-16 Thread tinnews
Marco Nawijn naw...@gmail.com wrote: On Monday, October 15, 2012 1:33:02 PM UTC+2, (unknown) wrote: I want to fix an error in some code I have installed, however I don't really want to just bodge it. The function producing the error is:- def get_text(self, idx):

What's the tidy/elegant way to protect this against null/empty parameters?

2012-10-15 Thread tinnews
I want to fix an error in some code I have installed, however I don't really want to just bodge it. The function producing the error is:- def get_text(self, idx): # override ! node = self.items[idx] a= [ , .join(node.tags), node.comment,

Re: What's the tidy/elegant way to protect this against null/empty parameters?

2012-10-15 Thread Paul Rubin
tinn...@isbd.co.uk writes: I want to fix an error in some code I have installed, however I don't really want to just bodge it. ... Now its *probably* something higher up the tree causing the problem (it's only one particular image in 20 thousand or so that breaks things) but I really want to

Re: What's the tidy/elegant way to protect this against null/empty parameters?

2012-10-15 Thread Chris Rebert
On Mon, Oct 15, 2012 at 4:23 AM, tinn...@isbd.co.uk wrote: I want to fix an error in some code I have installed, however I don't really want to just bodge it. bodge. Well, I learned a new word this morning! The function producing the error is:- def get_text(self, idx): #

Re: What's the tidy/elegant way to protect this against null/empty parameters?

2012-10-15 Thread Roy Smith
In article 1b8tk9-un9@chris.zbmc.eu, tinn...@isbd.co.uk wrote: The function producing the error is:- def get_text(self, idx): # override ! node = self.items[idx] a= [ , .join(node.tags), node.comment,

Re: What's the tidy/elegant way to protect this against null/empty parameters?

2012-10-15 Thread Miki Tebeka
I want to fix an error in some code I have installed, ... Apart from all the reasons why it's bad (see the Python Zen #10). One way to do it is: return [i or '' for i in a] -- http://mail.python.org/mailman/listinfo/python-list

Re: What's the tidy/elegant way to protect this against null/empty parameters?

2012-10-15 Thread Terry Reedy
On 10/15/2012 7:23 AM, tinn...@isbd.co.uk wrote: I want to fix an error in some code I have installed, however I don't really want to just bodge it. The function producing the error is:- def get_text(self, idx): # override ! node = self.items[idx] a= [