(Top-posting corrected.) On Wed, 30 Jan 2008 22:38:30 -0500, Sergio Correia wrote:
> On Jan 30, 2008 10:30 PM, Ben Finney > <[EMAIL PROTECTED]> wrote: >> MRAB <[EMAIL PROTECTED]> writes: >> >> > On Jan 31, 12:57 am, Asun Friere <[EMAIL PROTECTED]> wrote: >> > > Ouch!! If on the other hand 'females' is populated by instances of >> > > (or merely includes instances of) class 'Human', I suggest you test >> > > for female.consent somewhere in your code! >> > > >> > The Pythonic approach would be to try the action and catch a >> > NoConsentException. >> >> You're making the classic Pythonista mistake: you behave as though EAFP >> applies everywhere. I assure you, in the above situation, it does not >> apply. > > So in this case it is REALLY better to ask for permission rather than > forgiveness? Oh yes. The NoConsentException has a number of extremely unpleasant side- effects on both the code that raises it and the code that catches it. -- Steven -- http://mail.python.org/mailman/listinfo/python-list