[Python-ideas] Inline Functions - idea

Guido van Rossum guido at python.org
Thu Feb 6 03:47:35 CET 2014


On Wed, Feb 5, 2014 at 4:53 PM, Ethan Furman <ethan at stoneleaf.us> wrote:

> On 02/05/2014 04:15 PM, Guido van Rossum wrote:
>
>  On Wed, Feb 5, 2014 at 2:26 PM, Ethan Furman wrote:
>>
>>>
>>> Possibly, but it's easy enough to simulate (at least in
>>>  a read-only fashion) with **locals().
>>>
>>
>> Eew. Use of locals() for any purpose other than debugging should be
>> discouraged.
>>
>
> Well, as I recall (although I can't find it now) there was discussion
> about auto-filling a functions parameters with local values when the names
> matched, which would be much nicer is this situation (as well as extending
> situations).  For example:
>
> class MyString(str):
>   def find(sub, start, end):
>     ...
>     # manipulate sub and/or start and/or end
>     ...
>     return super().find(#blah#)
>
> where #blah# means "pick out sub, start, and end from locals and use them".
>

And how on earth would the compiler know the argument names?

-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140205/81740ee9/attachment.html>


More information about the Python-ideas mailing list