Re: [Tutor] Python and memory allocation

2013-10-26 Thread Mark Lawrence
On 26/10/2013 13:20, Steven D'Aprano wrote: On Thu, Oct 24, 2013 at 05:21:56PM +, Dave Angel wrote: If you want a surprise, try the following simple program some time. import sys print(sys.modules) when I tried that interactively on 2.7, it printed some 240+ names. Wow. What were you do

Re: [Tutor] Python and memory allocation

2013-10-26 Thread Steven D'Aprano
On Thu, Oct 24, 2013 at 05:21:56PM +, Dave Angel wrote: > If you > want a surprise, try the following simple program some time. > > import sys > print(sys.modules) > > when I tried that interactively on 2.7, it printed some 240+ names. Wow. What were you doing? Ah, I bet you had imported nu

Re: [Tutor] Python and memory allocation

2013-10-25 Thread Dave Angel
On 25/10/2013 08:20, #PATHANGI JANARDHANAN JATINSHRAVAN# wrote: > Hello All, > >>Similarly, if you call sorted() on a list of large strings, > you get a new list, but the strings are not duplicated, so it's not > nearly the duplication it might look like. > > 1. Sorry, but I did not understand t

Re: [Tutor] Python and memory allocation

2013-10-25 Thread #PATHANGI JANARDHANAN JATINSHRAVAN#
e were you talking about 'a' which is removed from the stack when it goes out of scope? Thanking You, Jatin From: Tutor on behalf of Dave Angel Sent: Friday, October 25, 2013 01:21 AM To: tutor@python.org Subject: Re: [Tutor] Python and memory

Re: [Tutor] Python and memory allocation

2013-10-24 Thread Danny Yoo
> And does python being an interpreted language have to do anything with this? I have to interrupt: you mean to say: "And does the C implementation of Python (CPython) have to do anything with this?". There are several implementations of Python out there. Not all of them use an interpreter in th

Re: [Tutor] Python and memory allocation

2013-10-24 Thread Alan Gauld
On 24/10/13 17:38, #PATHANGI JANARDHANAN JATINSHRAVAN# wrote: on. So, is there a concept of heap and stack in python or is it abstracted? Joel and Dave have given you the answers to this bit And does python being an interpreted language have to do anything with this? Nothing at all. In

Re: [Tutor] Python and memory allocation

2013-10-24 Thread Dave Angel
On 24/10/2013 12:38, #PATHANGI JANARDHANAN JATINSHRAVAN# wrote: > Hello All, > > Before starting to learn python, I first learnt C and C++ for a couple of > years. In C/C++, the choice to assign memory during compile time or during > execution time, i.e. assigning memory from the stack or th

Re: [Tutor] Python and memory allocation

2013-10-24 Thread Joel Goldstick
On Thu, Oct 24, 2013 at 12:38 PM, #PATHANGI JANARDHANAN JATINSHRAVAN# wrote: > Hello All, > > Before starting to learn python, I first learnt C and C++ for a couple > of years. In C/C++, the choice to assign memory during compile time or > during execution time, i.e. assigning memory from the

[Tutor] Python and memory allocation

2013-10-24 Thread #PATHANGI JANARDHANAN JATINSHRAVAN#
Hello All, Before starting to learn python, I first learnt C and C++ for a couple of years. In C/C++, the choice to assign memory during compile time or during execution time, i.e. assigning memory from the stack or the heap lay with the programmer right? But in Python, I have only seen exa