pass object or use self.object?
Lie Ryan
lie.1296 at gmail.com
Wed Apr 7 19:31:07 EDT 2010
On 04/07/10 18:34, Bruno Desthuilliers wrote:
> Lie Ryan a écrit :
> (snip)
>
>> Since in function in python is a first-class object, you can instead do
>> something like:
>>
>> def process(document):
>> # note: document should encapsulate its own logic
>> document.do_one_thing()
>
> Obvious case of encapsulation abuse here. Should a file object
> encapsulate all the csv parsing logic ? (and the html parsing, xml
> parsing, image manipulation etc...) ? Should a "model" object
> encapsulate the presentation logic ? I could go on for hours here...
Yes, but no; you're taking it out of context. Is {csv|html|xml|image}
parsing logic a document's logic? Is presentation a document's logic? If
they're not, then they do not belong in document.
More information about the Python-list
mailing list