Removing Pubic Hair Methods

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Thu Jan 31 00:44:08 EST 2008


(Top-posting corrected.)

On Wed, 30 Jan 2008 22:38:30 -0500, Sergio Correia wrote:

> On Jan 30, 2008 10:30 PM, Ben Finney
> <bignose+hates-spam at benfinney.id.au> wrote:
>> MRAB <google at mrabarnett.plus.com> writes:
>>
>> > On Jan 31, 12:57 am, Asun Friere <afri... at yahoo.co.uk> 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



More information about the Python-list mailing list