[Python-Dev] iterator API in Py3.0 (original) (raw)
Fredrik Lundh fredrik at pythonware.com
Sat Mar 4 07:27:41 CET 2006
- Previous message: [Python-Dev] iterator API in Py3.0
- Next message: [Python-Dev] iterator API in Py3.0
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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).
- Previous message: [Python-Dev] iterator API in Py3.0
- Next message: [Python-Dev] iterator API in Py3.0
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]