Re: [Python-ideas] Revised^4 PEP on yield-from
25 Feb
2009
25 Feb
'09
10:39 a.m.
Raymond Hettinger wrote:
The hasattr() tests can be expensive for repeated throwers and senders. Any merit to caching the result of the test?
The expansion is a specification of the semantics, not an implementation. My current implementation does something like _m = getattr(_i, 'throw', None) if _m: _m(_e) and a further optimisation would be to cache the bound method. -- Greg
5531
Age (days ago)
5531
Last active (days ago)
1 comments
2 participants
participants (2)
-
Greg Ewing
-
Raymond Hettinger