Raymond Hettinger wrote: > When teaching your classes, do you sense an aversion to using double > underscore methods in regular code? I sense an implied message that > these methods are not intended to be called directly (i.e. the discomfort > of typing x.__setitem__(k,v) serves as a cue to write x[k]=v instead; > likewise, x.__int__() pushes towards int(x) instead).
the "if called magically, it should be __xxx__" rule is pretty worthless on its own; you also need to answer the questions "called by whom ?" and "never called by application code ?" (from the sound of it, one could suspect that some posters here would like all template methods in all standard library components to use the __xxx__ form). </F> _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com