Re: scope of function parameters

On 5/29/2011 4:19 PM, Henry Olders wrote:

From my perspective, a function parameter should be considered as
having been assigned (although the exact assignment will not be known
until runtime), and as an assigned variable, it should be considered

That is exactly the case for Python functions.

>>> def f(a,b):
c,d = 3,4

>>> f.__code__.co_varnames # local names
('a', 'b', 'c', 'd')
>>> f(1,2)
{'a': 1, 'c': 3, 'b': 2, 'd': 4}

The requirement for a function call is that all parameters get an assignment and that all args are used in assignments (either directly by position or keyname or as part of a *args or **kwds assignment).

Terry Jan Reedy


Relevant Pages

  • Re: Modulo Counter in XST Synthesis?
    ... Andy wrote: ... Both args are right of the assignment so this is a "static" sample of the value of the whole expression. ... that does not require a wide AND tree would be: ...
  • Re: array assignement
    ... the assignment happens just fine. ... This sets $argsto be a reference to an anonymous array ... It has nothing whatsoever to do with %args. ...
  • need some programming help
    ... In an assignment A=B the number of elements in B and I must be the ... %fileName has to have no .daq extension in the args ...
  • Re: AClass ac=AClass("name",23); VS. AClass ac("name", 23);
    ... > because the first has to create a temporary object which is then ... There is NEVER any assignment in either of the cases. ... no compiler I've ever come accross fails to optimize away ... In both cases ac is built directly from the two args ...
  • Re: Fwd: class print method...
    ... *one* def statement and an assignment. ... Terry Jan Reedy ...