On Wed, Feb 28, 2018 at 10:59 PM, Steven D'Aprano
wrote:
> On Wed, 28 Feb 2018 18:01:42 +1100, Chris Angelico wrote:
>
>> If you really want a list of ALL the local names in a function, you can
>> look at its __code__ object, which has a tuple of variable names:
>>
>> print(func1.__code__.co_varna
On Wed, Feb 28, 2018 at 10:58 PM, Steven D'Aprano
wrote:
> On Wed, 28 Feb 2018 18:04:11 +1100, Chris Angelico wrote:
>> But if you know that
>> there's only a handful of variables that you'd actually want to do that
>> to, you can simply put those into an object of some form, and then
>> mutate th
On Wed, 28 Feb 2018 18:01:42 +1100, Chris Angelico wrote:
> If you really want a list of ALL the local names in a function, you can
> look at its __code__ object, which has a tuple of variable names:
>
> print(func1.__code__.co_varnames)
>
> That information is static to the function, as it is i
On Wed, 28 Feb 2018 18:04:11 +1100, Chris Angelico wrote:
> On Wed, Feb 28, 2018 at 5:54 PM, dieter wrote:
[...]
>> I am still working with Python 2 (Python 3 may behave differently).
>> There, during debugging, I would sometimes like to change the value of
>> variables (I know that the variable
On Wed, Feb 28, 2018 at 5:54 PM, dieter wrote:
> Ned Batchelder writes:
>> On 2/27/18 3:52 AM, Kirill Balunov wrote:
>>> a. Is this restriction for locals desirable in the implementation of
>>> CPython in Python 3?
>>> b. Or is it the result of temporary fixes for Python 2?
>>
>> My understandi
On Tue, Feb 27, 2018 at 5:55 AM, Kirill Balunov wrote:
> 2. The documentation has a note that "The contents of this dictionary
> should not be modified". Which implies that it is a read only mapping. So
> the question why it is `dict` instead of `types.MappingProxyType`?
A dict is smaller and fas
Ned Batchelder writes:
> On 2/27/18 3:52 AM, Kirill Balunov wrote:
>> a. Is this restriction for locals desirable in the implementation of
>> CPython in Python 3?
>> b. Or is it the result of temporary fixes for Python 2?
>
> My understanding is that the behavior of locals() is determined mostly
Kirill Balunov writes:
> 2018-02-27 2:57 GMT+03:00 Terry Reedy :
>
>> The point of point 3 is that terminology and details would likely be
>> different if Python were freshly designed more or less as it is today, and
>> some things only make more or less sense in historical context. Learn what
>>
2018-02-27 14:59 GMT+03:00 Ned Batchelder :
> On 2/27/18 3:52 AM, Kirill Balunov wrote:
>
>> a. Is this restriction for locals desirable in the implementation of
>> CPython in Python 3?
>> b. Or is it the result of temporary fixes for Python 2?
>>
>
> My understanding is that the behavior of lo
On 2/27/18 3:52 AM, Kirill Balunov wrote:
a. Is this restriction for locals desirable in the implementation of
CPython in Python 3?
b. Or is it the result of temporary fixes for Python 2?
My understanding is that the behavior of locals() is determined mostly
by what is convenient for the imp
2018-02-27 2:57 GMT+03:00 Terry Reedy :
> The point of point 3 is that terminology and details would likely be
> different if Python were freshly designed more or less as it is today, and
> some things only make more or less sense in historical context. Learn what
> you need to know to write code
On Mon, 26 Feb 2018 17:05:46 -0800, Dan Stromberg wrote:
[...]
> I don't have IronPython handy, but according my (quite possibly flawed)
> test program, locals() is a copy on CPython 3, CPython 2, Pypy3, Pypy,
> Jython and MicroPython.
>
> I didn't see any interpreters that returned the namespace
Kirill Balunov writes:
> I am a little bit confused with `locals` builtin in these moments:
>
> 1. The documentation says that _free varaibles_ are returned, which seems
> incorrect description. In my mind the term free variable refers to
> variables used in a function that are not local variables
On Mon, Feb 26, 2018 at 4:25 PM, Steven D'Aprano
wrote:
> On Mon, 26 Feb 2018 21:55:35 +0300, Kirill Balunov wrote:
>> 2. The documentation has a note that "The contents of this dictionary
>> should not be modified". Which implies that it is a read only mapping.
>> So the question why it is `dict`
On Mon, 26 Feb 2018 21:55:35 +0300, Kirill Balunov wrote:
> Hi,
>
> I am a little bit confused with `locals` builtin in these moments:
>
> 1. The documentation says that _free varaibles_ are returned, which
> seems incorrect description.
I can't answer that, sorry.
> 2. The documentation has
On 2/26/2018 1:55 PM, Kirill Balunov wrote:
Hi,
I am a little bit confused with `locals` builtin in these moments:
1. The documentation says that _free varaibles_ are returned, which seems
incorrect description. In my mind the term free variable refers to
variables used in a function that are n
16 matches
Mail list logo