Happy Christmas Pythoneers

Robert Kern robert.kern at gmail.com
Thu Dec 27 15:57:20 EST 2007


Gabriel Genellina wrote:
> En Thu, 27 Dec 2007 02:32:54 -0300, mensanator at aol.com  
> <mensanator at aol.com> escribió:
> 
>> On Dec 26, 9:43 pm, Steven D'Aprano
>> <ste... at REMOVE.THIS.cybersource.com.au> wrote:
> 
>>> watch_fireworks()
>>> try:
>>>     champagne
>>> except NameError:
>>>     champagne = any_fizzy_alcoholic_drink_will_do()
>>> champagne.drink()
>>> shout("Happy New Years!!!")
>>> for person in adults_nearby:
>>>     if (person.is_appropriate_sex and person.is_pretty):
>> Hey, my version of the person module doesn't have
>> an is_appropriate_sex attribute, but an
>> is_opposite_sex attribute instead. Is this a new version?
> 
> The default is_appropriate_sex implementation just happens to call  
> is_opposite_sex, but this is an implementation detail and you should not  
> rely on that, even more so if you didn't create that particular person  
> instance.

Although the coding standards in most shops prevent you from querying the
is_appropriate_sex interface if you create that particular person instance.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco




More information about the Python-list mailing list