Message96175
| Author |
kristjan.jonsson |
| Recipients |
kristjan.jonsson |
| Date |
2009年12月09日.17:27:11 |
| SpamBayes Score |
0.00015600011 |
| Marked as misclassified |
No |
| Message-id |
<1260379633.84.0.693013946466.issue7464@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
in urllib2, you will find these lines:
# Wrap the HTTPResponse object in socket's file object adapter
# for Windows. That adapter calls recv(), so delegate recv()
# to read(). This weird wrapping allows the returned object to
# have readline() and readlines() methods.
# XXX It might be better to extract the read buffering code
# out of socket._fileobject() and into a base class.
r.recv = r.read
fp = socket._fileobject(r, close=True)
This, storing a bound method in the instance, will cause a reference
cycle that the user knows nothing about.
I propose creating a wrapper instance with a recv() method instead. Or,
is there a standard way of storing bound methods on instances? A
'weakmethod', perhaps? |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2009年12月09日 17:27:13 | kristjan.jonsson | set | recipients:
+ kristjan.jonsson |
| 2009年12月09日 17:27:13 | kristjan.jonsson | set | messageid: <1260379633.84.0.693013946466.issue7464@psf.upfronthosting.co.za> |
| 2009年12月09日 17:27:11 | kristjan.jonsson | link | issue7464 messages |
| 2009年12月09日 17:27:11 | kristjan.jonsson | create |
|