Underscore/Camelcase insensitivity

Alexander Schmolck a.schmolck at gmx.net
Tue Feb 25 20:27:17 CET 2003

m.faassen at vet.uu.nl (Martijn Faassen) writes:

> Alexander Schmolck <a.schmolck at gmx.net> wrote:
> >>>> camelSplit('HTTPBaseHandler')
> > ['HTTP', 'base', 'handler']
> > 
> > # online cookbook recipe
> >>>> cw2us('HTTPBaseHandler')
> > 'http_base_handler' 
> > 
> > My code might be convoluted, but it certainly tries harder :)
> Neat! I haven't dared trying to read your code yet though. :)
> Regards,
> Martijn

Well, if you want to increase your confidence in that it works without having
to read it, I can send you the numerous test cases I wrote for it :)

But If you can come up with something readable that still

1) splits correctly
2) preserves all case information that is not used for boundary demarcation
3) moans about illegal input (but not about leading and trailing underbars)

that would be even better (and the test examples might help).


More information about the Python-list mailing list