Re: Question regarding the local function object

2019-03-16 Thread Gregory Ewing
Terry Reedy wrote: I believe that CPython function objects must currently all have the same size or at least the same max size and conclude that CPython currently allocates them from a block of memory that is some multiple of that size. I wouldn't be surprised if there is a free list for func

Re: Question regarding the local function object

2019-03-15 Thread Terry Reedy
On 3/15/2019 8:47 AM, Arup Rakshit wrote: Hi, I am reading a book where it says that: Just like module-level function definitions, the definition of a local function happens at run time when the def keyword is executed. Interestingly, this means that each call to sort_by_last_letter results i

Re: Question regarding the local function object

2019-03-15 Thread Arup Rakshit
Nice explanation. Thank you very much. Thanks, Arup Rakshit a...@zeit.io > On 15-Mar-2019, at 6:24 PM, Calvin Spealman wrote: > > This is actually part of a not entirely uncommon misconception that can arise > by comparing objects only by their > repr() outputs (the string representatio

Re: Question regarding the local function object

2019-03-15 Thread Calvin Spealman
This is actually part of a not entirely uncommon misconception that can arise by comparing objects only by their repr() outputs (the string representation created when you pass them to print). You're comparing the ID or memory address of the objects and determining they must be the same object. In

Question regarding the local function object

2019-03-15 Thread Arup Rakshit
Hi, I am reading a book where it says that: Just like module-level function definitions, the definition of a local function happens at run time when the def keyword is executed. Interestingly, this means that each call to sort_by_last_letter results in a new definition of the function last_let