On Wed, 06 Apr 2005 00:23:01 GMT, [EMAIL PROTECTED] (Bengt Richter) wrote:
>I don't know of anything other than the compiler and cpython sources.
>The byte codes are not all the same from version to version, since
>added language features may require new byte code operations, at least
>for efficie
On Tue, 05 Apr 2005 18:59:32 GMT, Ron_Adam <[EMAIL PROTECTED]> wrote:
>On Tue, 05 Apr 2005 06:52:58 GMT, [EMAIL PROTECTED] (Bengt Richter) wrote:
>
>>>Ok, yes, besides the globals, but I figured that part is obvious so I
>>>didn't feel I needed to mention it. The function call works the same
>>>e
On Tue, 05 Apr 2005 06:52:58 GMT, [EMAIL PROTECTED] (Bengt Richter) wrote:
>>Ok, yes, besides the globals, but I figured that part is obvious so I
>>didn't feel I needed to mention it. The function call works the same
>>even though they are not nested functions.
>
>I am afraid that is wrong. But
On Mon, 04 Apr 2005 02:13:29 GMT, Ron_Adam <[EMAIL PROTECTED]> wrote:
>On Sun, 03 Apr 2005 23:59:51 +0200, "Martin v. Löwis"
><[EMAIL PROTECTED]> wrote:
>
>>Ron_Adam wrote:
>>> This would be the same without the nesting:
>>>
>>> def foo(xx):
>>> global x
>>> x = xx
>>> return fee
>>>
On Sun, 03 Apr 2005 23:59:51 +0200, "Martin v. Löwis"
<[EMAIL PROTECTED]> wrote:
>Ron_Adam wrote:
>> This would be the same without the nesting:
>>
>> def foo(xx):
>> global x
>> x = xx
>> return fee
>>
>> def fee(y):
>> global x
>> return y*x
>>
>> z = foo(2)(6)
>
>Actually
Ron_Adam wrote:
This would be the same without the nesting:
def foo(xx):
global x
x = xx
return fee
def fee(y):
global x
return y*x
z = foo(2)(6)
Actually, it wouldn't.
>>> def foo(xx):
... global x
... x = xx
... return fee
...
>>> def fee(y):
... global x
... return
On 3 Apr 2005 00:11:22 -0800, "El Pitonero" <[EMAIL PROTECTED]>
wrote:
>Martin v. Löwis wrote:
>Perhaps this will make you think a bit more:
Now my problem is convincing the group I do know it. LOL
>Another example:
>
>def f():
> return f
>
>g = f()()()()()()()()()()()
>
>is perfectly valid.
On Sun, 03 Apr 2005 07:53:07 GMT, [EMAIL PROTECTED] (Bengt Richter) wrote:
>>No, I did not know that you could pass multiple sets of arguments to
>That phraseology doesn't sound to me like your concept space is quite
>isomorphic
>with reality yet, sorry ;-)
You'll be happy to know, my concept
On Sun, 03 Apr 2005 08:37:02 +0200, "Martin v. Löwis"
<[EMAIL PROTECTED]> wrote:
>Ron_Adam wrote:
>>>Ah, so you did not know functions are objects just like numbers,
>>>strings or dictionaries. I think you may have been influenced by other
>>>languages where there is a concept of static declaratio
Martin v. Löwis wrote:
> Ron_Adam wrote:
> >
> > No, I did not know that you could pass multiple sets of arguments
to
> > nested defined functions in that manner.
>
> Please read the statements carefully, and try to understand the
mental
> model behind them. He did not say that you can pass around
On Sun, 03 Apr 2005 05:09:07 GMT, Ron_Adam <[EMAIL PROTECTED]> wrote:
>On 2 Apr 2005 20:02:47 -0800, "El Pitonero" <[EMAIL PROTECTED]>
>wrote:
>
>>Ron_Adam wrote:
>>>
>>> So I didn't know I could do this:
>>>
>>> def foo(a1):
>>> def fee(a2):
>>> return a1+a2
>>> return fee
>>>
>>>
Ron_Adam wrote:
Ah, so you did not know functions are objects just like numbers,
strings or dictionaries. I think you may have been influenced by other
languages where there is a concept of static declaration of functions.
No, I did not know that you could pass multiple sets of arguments to
nested
On 2 Apr 2005 20:02:47 -0800, "El Pitonero" <[EMAIL PROTECTED]>
wrote:
>Ron_Adam wrote:
>>
>> So I didn't know I could do this:
>>
>> def foo(a1):
>> def fee(a2):
>> return a1+a2
>> return fee
>>
>> fum = foo(2)(6) <-- !!!
>
>Ah, so you did not know functions are objects just
Ron_Adam wrote:
>
> So I didn't know I could do this:
>
> def foo(a1):
> def fee(a2):
> return a1+a2
> return fee
>
> fum = foo(2)(6) <-- !!!
Ah, so you did not know functions are objects just like numbers,
strings or dictionaries. I think you may have been influenced by othe
On Sat, 02 Apr 2005 21:28:36 GMT, [EMAIL PROTECTED] (Bengt Richter) wrote:
>I think it might help you to start out with very plain decorators rather than
>decorators as factory functions that return decorator functions that wrap the
>decorated function in a wrapper function. E.g., (this could obvi
Hello Ron ,
You have many good explanations already, but I thought that this
__might__ help others.
Like you I was confused by the decorator syntax. till I realized it was
shorthand for ...
def identity(f):
return f
def foo():
pass
# this is the 'old way'
foo = identity(foo)
It just re
On Sat, 02 Apr 2005 14:29:08 GMT, Ron_Adam <[EMAIL PROTECTED]> wrote:
>
>I was having some difficulty figuring out just what was going on with
>decorators. So after a considerable amount of experimenting I was
>able to take one apart in a way. It required me to take a closer look
>at function de
> statements documenting the flow in a few minutes. I'm still a bit
> fuzzy on how the arguments are stored and passed.
The arguments are part of the outer scope of the function returned, and thus
they ar kept around. That's standart python,too:
def foo():
a = 10
def bar():
return
On 2 Apr 2005 07:22:39 -0800, "El Pitonero" <[EMAIL PROTECTED]>
wrote:
>Is it possible that you mistakenly believe your @decorator() is being
>executed at the line "func('Hello')"?
>
>Please add a print statement to your code:
>
>def decorator(d_arg):
> def get_function(function):
> pr
Ron_Adam wrote:
> def decorator(d_arg): # (7) Get 'Goodbye' off stack
>
> def get_function(function): # (8) Get func object off stack
>
> def wrapper(f_arg):# (9) Get 'Hello' off stack
>
> new_arg = f_arg+'-'+d_arg
> result = function(new_arg) # (10
Ron_Adam wrote:
>
> # (0) Read defined functions into memory
>
> def decorator(d_arg): # (7) Get 'Goodbye' off stack
>
> def get_function(function): # (8) Get func object off stack
>
> def wrapper(f_arg):# (9) Get 'Hello' off stack
>
> new_arg = f_arg+'-'+d_arg
>
I was having some difficulty figuring out just what was going on with
decorators. So after a considerable amount of experimenting I was
able to take one apart in a way. It required me to take a closer look
at function def's and call's, which is something I tend to take for
granted.
I'm not sure
22 matches
Mail list logo