>you're not listening.
Be sure that i do...The fact that i come from another world does not
mean that i am not listening, just that i find as strange some (new)
things.
Thank you all guys, i know what is happening now...
Thanks again!
kikapu
--
http://mail.python.org/mailman/listinfo/python-
"king kikapu" <[EMAIL PROTECTED]> wrote:
> Hmmm...ok...it calls the decorator but when ?? It (the runtime) loads
> the .py file and start to call every decorator
> it finds on it, regardless of the existance of code that actually calls
> the decorated functions ??
> I understand thet Python does n
On Mon, 2006-12-04 at 23:44 +0100, Fredrik Lundh wrote:
> Carsten Haese wrote:
>
> > * The function body gets compiled into byte code (but not executed).
>
> careful: when you get as far as executing the "def" statement, the
> function body has already been compiled. the byte code for the funct
Carsten Haese wrote:
> * The function body gets compiled into byte code (but not executed).
careful: when you get as far as executing the "def" statement, the
function body has already been compiled. the byte code for the function
is stored as a module-level constant:
>>> code = compile("def
On Mon, 2006-12-04 at 14:03 -0800, king kikapu wrote:
> I recap: if i put only functions declarations on a .py file, like
> these:
> def A(): print "a"
> def B(): print "b"
> def C(): print "c"
>
> and run the program, nothing happens, nothing executed.
Nothing *visible* happens. The "def" statem
king kikapu wrote:
> At first, i am coming from another (language) programming world (C#
> mainly) and i hope you understand my wonders.
>
> Ok then, you tell me that the interpreter always execute the code in a
> module...If there are only def declarations in the module and no code
> to invoke t
At first, i am coming from another (language) programming world (C#
mainly) and i hope you understand my wonders.
Ok then, you tell me that the interpreter always execute the code in a
module...If there are only def declarations in the module and no code
to invoke them it does not execute anythin
There was a copy-and-paste error with my last message. Better try this
for foobar.py:
def foo(f):
print "called foo"
return 'some text'
@foo
def bar():
print "called bar"
--
Soni Bergraj
http://www.YouJoy.org/
--
http://mail.python.org/mailman/listinfo/python-list
> Shouldn't this code called when we actually DO call it ?
Python statements are always executed to create the corresponding class
and function objects when a module is imported.
Cheers,
--
Soni Bergraj
http://www.YouJoy.org/
--
http://mail.python.org/mailman/listinfo/python-list
king kikapu wrote:
> Hmmm...ok...it calls the decorator but when ?? It (the runtime) loads
> the .py file and start to call every decorator
you seem to be missing that the interpreter *always* executes the code
in a module to find out what it contains. "def" and "class" are exe-
cutable statem
> Hmmm...ok...it calls the decorator but when ?? It (the runtime) loads
> the .py file and start to call every decorator
> it finds on it, regardless of the existance of code that actually calls
> the decorated functions ??
> I understand thet Python does not call the decoratated functiond but it
>
> def func():
> pass
>
> is *exactly* the same thing as:
>
> def func():
> pass
> func = decorator(func)
Yes, i know that but i thought that it is so when I call the function,
not when the runtime just loads the module...
>Python calls the decorator, not the dec
king kikapu wrote:
> It will load all the module, all the functions and when it sees that
> some function(s) are decorating, then it will start execute respectives
> decorators ?
@decorator
def func():
pass
is *exactly* the same thing as:
def func():
pass
f
13 matches
Mail list logo