Hello all,
I am trying to inherit the file object and don't know how to do it. I
need to open a file and perform operations on it in the class I am
writing. I know the simple syntax is:
class MyClass(file):
...
but I don't know how to make it open the file for
On 06.07.2005, at 18:58, Jeremy wrote:
Hello all,
I am trying to inherit the file object and don't know how to do it. I
need to open a file and perform operations on it in the class I am
writing. I know the simple syntax is:
class MyClass(file):
...
but I don't know how to
Jeremy wrote:
Hello all,
I am trying to inherit the file object and don't know how to do it. I
need to open a file and perform operations on it in the class I am
writing. I know the simple syntax is:
class MyClass(file):
...
but I don't know how to make it open the file for
Jeremy Jones wrote:
Something like this? I put the following code in test_file.py:
class MyFile(file):
def doing_something(self):
print in my own method
And used it like this:
In [1]: import test_file
In [2]: f = test_file.MyFile(foobar.file, w)
In [3]:
I don't know if I should be inheriting file or just using a file
object.
How would I determine which one would be more appropriate?
Inheritance is often refered to as an IS relation, whereas using an
attribute
is a HAS relation.
If you inherit from file, all operations for files should be
harold fellermann wrote:
I don't know if I should be inheriting file or just using a file
object.
How would I determine which one would be more appropriate?
Inheritance is often refered to as an IS relation, whereas using an
attribute
is a HAS relation.
If you inherit from file, all