<p dir="ltr"><br>
On 13 May 2013 00:22, "Greg Ewing" <<a href="mailto:greg.ewing@canterbury.ac.nz">greg.ewing@canterbury.ac.nz</a>> wrote:<br>
><br>
> Wayne Werner wrote:<br>
>><br>
>> On Fri, 10 May 2013, Gregory Ewing wrote:<br>
>><br>
>>>   f = open("myfile.dat")<br>
>>>   f.close()<br>
>>>   data = f.read()<br>
>><br>
>><br>
>> To clarify - you don't want a class that has functions that need to be called in a certain order with *valid input* in order to not crash.<br>
>><br>
>> Exactly what does happen - a ValueError is raised because you're(*) passing self into the file.read() function, and that input is invalid<br>
><br>
><br>
> The same argument can be applied to:<br>
><br>
>    foo = Foo()<br>
>    foo.do_something()<br>
>    foo.enable() # should have done this first<br>
><br>
> You're passing an invalid input to Foo.do_something,<br>
> namely a Foo that hasn't been enabled yet.<br>
><br>
><br>
> -- <br>
> Greg<br>
> -- <br>
> <a href="http://mail.python.org/mailman/listinfo/python-list">http://mail.python.org/mailman/listinfo/python-list</a></p>
<p dir="ltr">I don't think you can really count that as invalid input in OOP terms. After all in most languages `self` / `this` / whatever is not an argument to every method.<br>
</p>