[Tutor] who makes FOR loop quicker

2015-08-05 Thread John Doe
To pass by reference or by copy of - that is the question from hamlet. ("hamlet" - a community of people smaller than a village python3.4-linux64) xlist = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] i = 0 for x in xlist: print(xlist) print("\txlist[%d] = %d" % (i, x)) if x%2 == 0

Re: [Tutor] who makes FOR loop quicker

2015-08-06 Thread John Doe
Can You, please, elaborate this "..Passing in Python is different than in C or other languages..." 'Cause as far as I know - default major Python's implementation CPython is written in C. Joel Goldstick 於 08/05/2015 03:44 PM 寫道: On Wed, Aug 5, 2015 at 3:53 AM, John

Re: [Tutor] who makes FOR loop quicker

2015-08-06 Thread John Doe
TEMENT, which must be created only once. Any INITIATIONS make once. 'Cause it sucks CPU-memory-allocation-cycle. Does this point make sense for You? Joel Goldstick 於 08/06/2015 03:57 PM 寫道: On Thu, Aug 6, 2015 at 4:34 AM, John Doe wrote: Can You, please, elaborate this "..Passing in P

Re: [Tutor] who makes FOR loop quicker

2015-08-06 Thread John Doe
5 04:45 PM 寫道: On Thu, Aug 06, 2015 at 11:34:51AM +0300, John Doe wrote: Can You, please, elaborate this "..Passing in Python is different than in C or other languages..." Argument passing in Python is: - different to Perl, C, Scala, Algol and Pascal; - the same as Ruby, Lua, Apple

Re: [Tutor] who makes FOR loop quicker

2015-08-06 Thread John Doe
7;Aprano 於 08/06/2015 05:21 PM 寫道: On Thu, Aug 06, 2015 at 08:57:34AM -0400, Joel Goldstick wrote: On Thu, Aug 6, 2015 at 4:34 AM, John Doe wrote: Can You, please, elaborate this "..Passing in Python is different than in C or other languages..." I hesitate, because this question is

Re: [Tutor] who makes FOR loop quicker

2015-08-06 Thread John Doe
bit. It would be great to work with You. You know, life is so shot.. And any talks don't make it better, alas. Just we can do. Alan Gauld 於 08/06/2015 09:54 PM 寫道: On 06/08/15 14:28, John Doe wrote: Well, I think, both of us understands that any reference isn't about any sort

[Tutor] Iterating Lines in File and Export Results

2014-10-02 Thread John Doe
Hello List, I am in need of your assistance. I have a text file with random words in it. I want to write all the lines to a new file. Additionally, I am using Python 2.7 on Ubuntu 12.04: Here is my code: def loop_extract(): with open('words.txt', 'r') as f: for lines in f:

Re: [Tutor] printing all text that begins with "25"

2014-10-02 Thread John Doe
Hello, If you want to accomplish what you are looking for within linux (perhaps a bash script, instead?): $ hamachi list | grep -oP '25\.\d+\.\d+\.\d+' 25.0.0.0 25.255.255.255 For your python script, you want to group your regex: reg = re.compile(r'(25\.\d+\.\d+\.\d+)', re.MULTILINE) So when yo

Re: [Tutor] Iterating Lines in File and Export Results

2014-10-02 Thread John Doe
2014 at 6:08 PM, Peter Otten <__pete...@web.de> wrote: > John Doe wrote: > >> Hello List, >> I am in need of your assistance. I have a text file with random words >> in it. I want to write all the lines to a new file. Additionally, I am >> using Python 2