Re: [Tutor] Iterating through a list of strings

2010-05-02 Thread Stefan Behnel
Thomas C. Hicks, 03.05.2010 07:16: %Comment introducing the next block of packages %Below are the packages for using Chinese on the system %Third line of comment because I am a verbose guy! ibus-pinyin ibus-table-wubi language-pack-zh-hans etc. I read the lines of the file into a list for proce

[Tutor] Iterating through a list of strings

2010-05-02 Thread Thomas C. Hicks
I am using Python 2.6.4 in Ubuntu. Since I use Ubuntu (with its every 6 months updates) and want to learn Python I have been working on a post-install script that would get my Ubuntu system up and running with my favorite packages quickly. Basically the script reads a text file, processes the lin

Re: [Tutor] python list, right! but concretely?

2010-05-02 Thread Alan Gauld
"spir ☣" wrote ...When writing "size = size + new_allocated" instead of "size = new_allocated", It get a growth pattern of: 0 3 6 9 16 24 33 43 54 66 80 96 114 Which is not exactly what is stated in code, but rather similar... You mean like this line in the source?: new_allocated += news

Re: [Tutor] Is there a better way to use scientific notation in an equation?

2010-05-02 Thread Eike Welk
On Sunday May 2 2010 22:44:42 David Hutto wrote: > Q1 and Q2 are to be entered as base ten scientific notation. > When I try to input Q1 as raw input, entering in ((2*(10**7)), I get: > > ValueError: invalid literal for int() with base 10: '((2)*(10**7))' > > Which is why I broke it down into it'

Re: [Tutor] Is there a better way to use scientific notation in an equation?

2010-05-02 Thread Steven D'Aprano
On Mon, 3 May 2010 06:44:42 am David Hutto wrote: > In the following code I'm trying to do basic calculations with > coulumb's law > > #Coulombs Law > ''' > F = (9*(10**9)) * (Q1*Q2) / (d**2) > ''' > base = 10 > Q1mult = raw_input('First enter multiplier of base 10 > charge/coloumb(Q1):') Q1exp = r

[Tutor] Is there a better way to use scientific notation in an equation?

2010-05-02 Thread David Hutto
In the following code I'm trying to do basic calculations with coulumb's law #Coulombs Law ''' F = (9*(10**9)) * (Q1*Q2) / (d**2) ''' base = 10 Q1mult = raw_input('First enter multiplier of base 10 charge/coloumb(Q1):') Q1exp = raw_input('Now enter exponent of base 10(Q1):') Q1 = int(Q1mult)*(10**

Re: [Tutor] python list, right! but concretely?

2010-05-02 Thread spir ☣
On Mon, 3 May 2010 00:50:40 +1000 Steven D'Aprano wrote: > On Sun, 2 May 2010 07:44:22 pm Lie Ryan wrote: > > > Python's 'list' is an array of pointers to `PyObject` ('object' in > > Python) and the resizing algorithm keeps the list size such that > > "allocated / 2 <= actual <= allocated". When

Re: [Tutor] python list, right! but concretely?

2010-05-02 Thread Steven D'Aprano
On Sun, 2 May 2010 07:44:22 pm Lie Ryan wrote: > Python's 'list' is an array of pointers to `PyObject` ('object' in > Python) and the resizing algorithm keeps the list size such that > "allocated / 2 <= actual <= allocated". When list need to resize, it > overallocates the list slightly over 1.125

Re: [Tutor] python list, right! but concretely?

2010-05-02 Thread spir ☣
On Sun, 2 May 2010 18:57:41 +1000 Steven D'Aprano wrote: > On Sun, 2 May 2010 03:49:02 pm spir ☣ wrote: > > Hello, > > > > Is there anywhere some introduction material to the implementation of > > python lists (or to fully dynamic and flexible sequences, in > > general)? More precisely, I'd like

Re: [Tutor] python list, right! but concretely?

2010-05-02 Thread spir ☣
On Sun, 02 May 2010 19:44:22 +1000 Lie Ryan wrote: > On 05/02/10 15:49, spir ☣ wrote: > > Hello, > > > > Is there anywhere some introduction material to the implementation of > > python lists > > (or to fully dynamic and flexible sequences, in general)? > > > > More precisely, I'd like to kno

Re: [Tutor] python list, right! but concretely?

2010-05-02 Thread Lie Ryan
On 05/02/10 15:49, spir ☣ wrote: > Hello, > > Is there anywhere some introduction material to the implementation of python > lists > (or to fully dynamic and flexible sequences, in general)? > More precisely, I'd like to know what kind of base data-structure is used > (linked list, dynamic arra

Re: [Tutor] python list, right! but concretely?

2010-05-02 Thread Steven D'Aprano
On Sun, 2 May 2010 03:49:02 pm spir ☣ wrote: > Hello, > > Is there anywhere some introduction material to the implementation of > python lists (or to fully dynamic and flexible sequences, in > general)? More precisely, I'd like to know what kind of base > data-structure is used (linked list, dynami

Re: [Tutor] python list, right! but concretely?

2010-05-02 Thread Alan Gauld
"spir ☣" wrote Is there anywhere some introduction material to the implementation of python lists (or to fully dynamic and flexible sequences, in general)? The definitive information is the source code which is freely available. More precisely, I'd like to know what kind of base data-structu