[Python-Dev] PEP 292: method names

Erik Heneryd erik at heneryd.com
Sat Sep 11 15:04:16 CEST 2004


Erik Heneryd wrote:
> * Safe?
> safe_substitution doesn't tell you much upon first glance.  Safe?  In 
> what way?  You could even argue that the "plain" version really is the 
> safer one, as you'll notice typos and thus get a more solid program.  I 
> think a name hinting that this method uses the var name as a fallback 
> would be better, but can't think of (a short) one...  defaultsub? 
> fallbacksub?  loosesub?  Guess I could live with safe, but...

Come to think of it, I really like the more OO-ish approach better, than 
to cram everything into a single class.  Is the safe_substitute really 
that special it deserves a special method?  Is it really the one, true 
way to do a "safe" substitution?  IIRC DOS and sh don't agree, so it's 
not that obvious.

I say keep the inheritance thing, it's much more flexible, and delegate 
the KeyError condition to an overridable method.

Erik



More information about the Python-Dev mailing list