Newbie learning OOP

Terry Hancock hancock at anansispaceworks.com
Wed Jun 1 14:02:02 EDT 2005


On Sunday 29 May 2005 03:18 pm, John Machin wrote:
> LenS wrote:
> > Trying to learn OOP concepts and decided to use Python for this
> > purpose.  I have coded the following CLASS and it seems to work fine.
> > Any comments on the code or suggestions would be appreciated.

> A practical problem: not everbody's name can be shoe-horned into the 
> first/initial/last model. You face catastrophic loss of information.
> 
> Some examples, with "last" name in capitals:
> 
> J. Edgar HOOVER -> J E HOOVER
> Rip J. VAN WINKLE -> Rip J VAN
> Jean Paul DE LA SALLE -> Jean P DE
> DE LA SALLE, Jean Paul -> LA S DE
> MAO Tse Tung -> Tse T MAO # or MAO T Tung
> MAO Tse-tung -> Tse-tung M <empty> # or an IndexError
> MAO Zedong -> Zedong M <empty> # or an IndexError
> Vigdis ERIKSDOTTIR -> Vigdis E <empty> # and lost the gender, too
> Gunnlaug ILLUGASON Ormstunga -> Gunnlaug I Ormstunga # nickname 
> "Snakestongue"
> Ivan Denisovich SHUKHOV -> Ivan D SHUKHOV # and lost father's "first" 
> name, too
> Friedrich Heinrich Karl VON UND ZU HOHENLOHE -> Friedrich H Karl
> NGUYEN Thi Thanh Van -> Thi T NGUYEN
> # "Thi" means "female" and "Nguyen" is the "last" name of about 50% of 
> the Vietnamese population ...

While I might say something snide about unnecessarily crucifying a piece
of "toy" code for learning OOP, this is *really* nice set of test cases! Thank
you, I'm saving this for reference.  :-)

Cheers,
Terry

--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks  http://www.anansispaceworks.com




More information about the Python-list mailing list