[Baypiggies] Python way to avoid usage of raise

Tung Wai Yip tungwaiyip at yahoo.com
Wed Oct 6 06:03:25 CEST 2010

Why do you want to do this? Is this just an internal coding guideline? Or  
is it done for interfacing to another language or running on non-standard  
VM? Is this apply to new code only or do you want to update existing code  
as well?

There is no equivalent of C macro in Python. Just apply every code change  
as you describe it. Build a tuple every time you return something. Change  
raise into returning tuple. And change ever function call to expecting a  
tuple return value. I can't think of anything smarter. it looks like a  
complete disaster anyway.

Wai yip

> Let's skip the rationale discussion although I feel better for your
> sympathy.  One non python solution I can think of is Macro (C/C++) or  
> add a
> new command  which could work in any stack frame (TCL).
> However, I'm quite new to python so I'm not so sure if there are some  
> ways
> around this.
> Can we have something similar to macro in python ?
> On Tue, Oct 5, 2010 at 7:27 PM, Glen Jarvis <glen at glenjarvis.com> wrote:
>> > My work place has imposed a rules for no use of exception (catching is
>> allowed).
>> What?!?
>> Forgive my reaction, I'm just very surprised. Why has your workplace
>> implemented this policy? Has anyone else on BayPIGgies seen a  policy  
>> like
>> this? What's the rationale?  Am I a Luddite for not hearing on this?
>> I'm sorry. I know you asked a genuine question and I haven't answered  
>> it. I
>> just found this very odd and am first getting my head around the  
>> question.
>> Cheers,
>> Glen

Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

More information about the Baypiggies mailing list