Re: Py3K: file inheritance

2011-10-21 Thread Yosifov Pavel
On 21 окт, 13:50, Ian Kelly wrote: > On Thu, Oct 20, 2011 at 10:17 PM, Yosifov Pavel wrote: > > Little silly example: > > > class MyFile(file): > > šdef __init__(self, *a, **ka): > > š šsuper(MyFile, self).__init__(*a, **ka) > > š šself.commented = 0 > > šdef write(self, s): > > š šif s.startswit

Re: Py3K: file inheritance

2011-10-20 Thread Ian Kelly
On Thu, Oct 20, 2011 at 10:17 PM, Yosifov Pavel wrote: > Little silly example: > > class MyFile(file): >  def __init__(self, *a, **ka): >    super(MyFile, self).__init__(*a, **ka) >    self.commented = 0 >  def write(self, s): >    if s.startswith("#"): >      self.commented += 1 >      super(MyFi

Re: Py3K: file inheritance

2011-10-20 Thread Yosifov Pavel
On 21 окт, 00:42, Ian Kelly wrote: > On Thu, Oct 20, 2011 at 11:28 AM, Yosifov Pavel wrote: > > In the Python 2.x was simple to create own file object: > > > class MyFile(file): > > špass > > > for example to reimplement write() or something else. How to do it in > > Python 3.x? > > See the docs

Re: Py3K: file inheritance

2011-10-20 Thread Ian Kelly
On Thu, Oct 20, 2011 at 11:28 AM, Yosifov Pavel wrote: > In the Python 2.x was simple to create own file object: > > class MyFile(file): >  pass > > for example to reimplement write() or something else. How to do it in > Python 3.x? See the docs for the io module. Depending on what you want to d

Py3K: file inheritance

2011-10-20 Thread Yosifov Pavel
In the Python 2.x was simple to create own file object: class MyFile(file): pass for example to reimplement write() or something else. How to do it in Python 3.x? -- http://mail.python.org/mailman/listinfo/python-list