This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
| Author | esrever_otua |
|---|---|
| Recipients | esrever_otua |
| Date | 2008年04月11日.02:45:13 |
| SpamBayes Score | 0.055156577 |
| Marked as misclassified | No |
| Message-id | <1207881915.59.0.417748346236.issue2612@psf.upfronthosting.co.za> |
| In-reply-to |
| Content | |
|---|---|
Compare:
>>> class y(file):
... def __init__(self, name):
... file.__init__(self, name)
... def __len__(self):
... self.seek(0, 2)
... return self.tell()
...
>>> n = y('/tmp/longfile')
>>> len(n)
364773376
Versus:
>>> class z:
... def __init__(self, name):
... self.f = file(name, 'r')
... def __len__(self):
... self.f.seek(0, 2)
... return self.f.tell()
...
>>> x = z('/tmp/longfile')
>>> len(x)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: __len__() should return an int
Because:
>>> x = file('/tmp/longfile')
>>> type(x.tell())
<type 'long'> |
|
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2008年04月11日 02:45:15 | esrever_otua | set | spambayes_score: 0.0551566 -> 0.055156577 recipients: + esrever_otua |
| 2008年04月11日 02:45:15 | esrever_otua | set | spambayes_score: 0.0551566 -> 0.0551566 messageid: <1207881915.59.0.417748346236.issue2612@psf.upfronthosting.co.za> |
| 2008年04月11日 02:45:14 | esrever_otua | link | issue2612 messages |
| 2008年04月11日 02:45:13 | esrever_otua | create | |