A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2009-April/088095.html below:

[Python-Dev] issue5578 - explanation

[Python-Dev] issue5578 - explanationGuido van Rossum guido at python.org
Thu Apr 2 23:49:22 CEST 2009
On Thu, Apr 2, 2009 at 2:21 PM, Chris Withers <chris at simplistix.co.uk> wrote:
> Guido van Rossum wrote:
>>>
>>> from functools import partial
>>> from new import instancemethod
>>>
>>> def meth(name,self,*args):
>>>   return getattr(self._sock,name)(*args)
>>>
>>> for _m in _socketmethods:
>>>   p = partial(meth,_m)
>>>   p.__name__ = _m
>>>   p.__doc__ = getattr(_realsocket,_m).__doc__
>>>   m = instancemethod(p,None,_socketobject)
>>>   setattr(_socketobject,_m,m)
>>>
>>> Have I missed something or is that a suitable replacement that gets rid
>>> of
>>> the exec nastiness?
>>
>> That code in socket.py is much older that functools... I don't know if
>> the dependency matters, probably not.
>>
>> But anyways this is moot, the bug was only about exec in a class body
>> *nested inside a function*.
>
> Indeed, I just hate seeing execs and it was an interesting mental exercise
> to try and get rid of the above one ;-)
>
> Assuming it breaks no tests, would there be objection to me committing the
> above change to the Python 3 trunk?

That's up to Benjamin. Personally, I live by "if it ain't broke, don't
fix it." :-)

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4