Re: Confused with Functions and decorators

2014-07-21 Thread Steven D'Aprano
On Mon, 21 Jul 2014 00:30:00 -0700, CHIN Dihedral wrote: > Uhn, a local object inside a function can be passed back in Python. > > Of course, a local function is treated as an object in Python,and the GC > is built-in. Sigh, the Dihedral bot is not what it used to be... -- Steven -- https://

Re: Confused with Functions and decorators

2014-07-21 Thread CHIN Dihedral
On Saturday, July 19, 2014 8:44:25 PM UTC+8, Wojciech Giel wrote: > On 19/07/14 12:40, Jerry lu wrote: > > > oh yeah i forgot about the decorators. Um say that you wanted to decorate a > > function with the outer() func you would just put @outer on top of it? And > > this is the same as passing

Re: Confused with Functions and decorators

2014-07-19 Thread Steven D'Aprano
On Sat, 19 Jul 2014 03:52:18 -0700, Jerry lu wrote: > Ok so i am trying to learn this and i do not understand some of it. I > also tried to searched the web but i couldnt find any answers. > > 1. I dont understand when i will need to use a function that returns > another function. eg >

Re: Confused with Functions and decorators

2014-07-19 Thread Jerry lu
Ok thanks so much i really want to get good. I also found this MIT open course lectures for python. Is this good to use as a source of learning? I think it would because it is MIT. -- https://mail.python.org/mailman/listinfo/python-list

Re: Confused with Functions and decorators

2014-07-19 Thread Chris Angelico
On Sun, Jul 20, 2014 at 12:24 PM, Jerry lu wrote: > ok I seem to very confused about this. Is there like a page or web page that > like completely sums this up so i can study. I am going to look up 'functions > in python'. Yep, look up stuff like that. I gave you some keywords to search for (we

Re: Confused with Functions and decorators

2014-07-19 Thread Jerry lu
ok I seem to very confused about this. Is there like a page or web page that like completely sums this up so i can study. I am going to look up 'functions in python'. I am not sure if this is what we a talking about as a whole here but I'am sure that I'll find something. I am all good with decor

Re: Confused with Functions and decorators

2014-07-19 Thread Wojciech Giel
On 19/07/14 12:40, Jerry lu wrote: oh yeah i forgot about the decorators. Um say that you wanted to decorate a function with the outer() func you would just put @outer on top of it? And this is the same as passing another func into the outer func? yes. syntax was added because with very long f

Re: Confused with Functions and decorators

2014-07-19 Thread Wojciech Giel
On 19/07/14 11:52, Jerry lu wrote: Ok so i am trying to learn this and i do not understand some of it. I also tried to searched the web but i couldnt find any answers. 1. I dont understand when i will need to use a function that returns another function. eg def outer():

Re: Confused with Functions and decorators

2014-07-19 Thread Wojciech Giel
On 19/07/14 11:52, Jerry lu wrote: Ok so i am trying to learn this and i do not understand some of it. I also tried to searched the web but i couldnt find any answers. 1. I dont understand when i will need to use a function that returns another function. eg def outer():

Re: Confused with Functions and decorators

2014-07-19 Thread Jerry lu
Ok thanks man I have never used forums and stuff before but it is great help thank you so much. -- https://mail.python.org/mailman/listinfo/python-list

Re: Confused with Functions and decorators

2014-07-19 Thread Chris Angelico
On Sat, Jul 19, 2014 at 9:40 PM, Jerry lu wrote: > oh yeah i forgot about the decorators. Um say that you wanted to decorate a > function with the outer() func you would just put @outer on top of it? And > this is the same as passing another func into the outer func? > > and also with the first

Re: Confused with Functions and decorators

2014-07-19 Thread Jerry lu
oh yeah i forgot about the decorators. Um say that you wanted to decorate a function with the outer() func you would just put @outer on top of it? And this is the same as passing another func into the outer func? and also with the first example you say x is in the scope when is was created can

Re: Confused with Functions and decorators

2014-07-19 Thread Chris Angelico
On Sat, Jul 19, 2014 at 8:52 PM, Jerry lu wrote: > Ok so i am trying to learn this and i do not understand some of it. I also > tried to searched the web but i couldnt find any answers. > > 1. I dont understand when i will need to use a function that returns another > function. > eg >

Confused with Functions and decorators

2014-07-19 Thread Jerry lu
Ok so i am trying to learn this and i do not understand some of it. I also tried to searched the web but i couldnt find any answers. 1. I dont understand when i will need to use a function that returns another function. eg def outer(): def inner():