Newbie learning OOP

Terry Hancock hancock at
Wed Jun 1 20:02:02 CEST 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:
> 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.  :-)


Terry Hancock ( hancock at )
Anansi Spaceworks

More information about the Python-list mailing list