Re: what a cheap rule

2010-11-26 Thread Fuzzyman
On Nov 26, 1:10 am, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: On Thu, 25 Nov 2010 08:15:21 -0800, Yingjie Lan wrote: Intuition #1: as if you raise an exception type, and then match that type. It seems that no instances are involved here (Intuitively). Your intuition

what a cheap rule

2010-11-25 Thread Yingjie Lan
Sometimes the golden rule in Python of explicit is better than implicit is so cheap that it can be thrown away for the trouble of typing an empty tuple. Today when I am explaining that in Python 3, there are two ways to raise exceptions: raise Exception raise Exception() and that the first one

Re: what a cheap rule

2010-11-25 Thread Steve Holden
On 11/25/2010 3:12 AM, Yingjie Lan wrote: Sometimes the golden rule in Python of explicit is better than implicit is so cheap that it can be thrown away for the trouble of typing an empty tuple. I'm not sure that there *are* any golden rules. The Zen of Python is intended to be guidelines,

Re: what a cheap rule

2010-11-25 Thread Yingjie Lan
--- On Thu, 11/25/10, Steve Holden st...@holdenweb.com wrote: Sometimes the golden rule in Python of explicit is better than implicit is so cheap that it can be thrown away for the trouble of typing an empty tuple. I'm not sure that there *are* any golden rules. The Zen of Python is

Re: what a cheap rule

2010-11-25 Thread Steve Holden
On 11/25/2010 10:15 AM, Yingjie Lan wrote: As I am thinking about it, it seems two conflicting intuition of code comprehension are at work here: Intuition #1: as if you raise an exception type, and then match that type. It seems that no instances are involved here (Intuitively). See an

Re: what a cheap rule

2010-11-25 Thread Terry Reedy
On 11/25/2010 4:12 AM, Yingjie Lan wrote: Sometimes the golden rule in Python of explicit is better than implicit is so cheap that it can be thrown away for the trouble of typing an empty tuple. Today when I am explaining that in Python 3, there are two ways to raise exceptions: raise

Re: what a cheap rule

2010-11-25 Thread Steven D'Aprano
On Thu, 25 Nov 2010 08:15:21 -0800, Yingjie Lan wrote: Intuition #1: as if you raise an exception type, and then match that type. It seems that no instances are involved here (Intuitively). Your intuition is not my intuition, nor does it match what Python actually does. You can only go so

Re: what a cheap rule

2010-11-25 Thread Yingjie Lan
--- On Fri, 11/26/10, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: From: Steven D'Aprano steve+comp.lang.pyt...@pearwood.info Subject: Re: what a cheap rule To: python-list@python.org Date: Friday, November 26, 2010, 5:10 AM On Thu, 25 Nov 2010 08:15:21 -0800, Yingjie Lan