Re: Encrypt python files

2015-05-05 Thread Steven D'Aprano
On Wednesday 06 May 2015 16:37, Palpandi wrote: > Hi, > > What are the ways to encrypt python files? The same as the ways to encrypt any other file. Your encryption program shouldn't care whether you are encrypting text files, JPEGs, mp3 audio files, executable binary code, Python scripts, or

Re: Encrypt python files

2015-05-05 Thread David Palao
Hello, I'm afraid your question is either not well defined (or not well enough) or wrong for this list, at least as I understand it. Could you please explain it better? Best 2015-05-06 8:37 GMT+02:00 Palpandi : > Hi, > > What are the ways to encrypt python files? > -- > https://mail.python.org/ma

Encrypt python files

2015-05-05 Thread Palpandi
Hi, What are the ways to encrypt python files? -- https://mail.python.org/mailman/listinfo/python-list

Re: Writing list of dictionaries to CSV

2015-05-05 Thread Chris Angelico
On Wed, May 6, 2015 at 3:32 PM, Kashif Rana wrote: > thanks for the feedback. I think its problem with excel itself, showing wrong > value. Because when I opened the csv file in text editor, I can see correct > value but opening in excel showing wrong value. What I can do to see correct > in ex

Re: Throw the cat among the pigeons

2015-05-05 Thread Steven D'Aprano
On Wednesday 06 May 2015 14:05, Steven D'Aprano wrote: [...] Here are those anomalous timing results again: > code = "fact(5)" > t1 = Timer(code, setup="from __main__ import factorial_while as fact") > t2 = Timer(code, setup="from __main__ import factorial_reduce as fact") > t3 = Timer(code,

Re: Throw the cat among the pigeons

2015-05-05 Thread Ian Kelly
On Tue, May 5, 2015 at 7:27 PM, Steven D'Aprano wrote: > Only the minimum is statistically useful. I disagree. The minimum tells you how fast the code *can* run, under optimal circumstances. The mean tells you how fast it *realistically* runs, under typical load. Both can be useful to measure. --

Re: asyncio: What is the difference between tasks, futures, and coroutines?

2015-05-05 Thread Steven D'Aprano
On Wednesday 06 May 2015 14:47, Rustom Mody wrote: > It strikes me that the FP crowd has stretched the notion of function > beyond recognition And the imperative/OO folks have distorted it beyond > redemption. In what way? > And the middle road shown by Pascal has been overgrown with weeds for

Re: Writing list of dictionaries to CSV

2015-05-05 Thread Kashif Rana
Hello guys thanks for the feedback. I think its problem with excel itself, showing wrong value. Because when I opened the csv file in text editor, I can see correct value but opening in excel showing wrong value. What I can do to see correct in excel as well. Regards On Tuesday, May 5, 2015 a

Re: asyncio: What is the difference between tasks, futures, and coroutines?

2015-05-05 Thread Rustom Mody
On Tuesday, May 5, 2015 at 11:15:42 PM UTC+5:30, Marko Rauhamaa wrote: > Personally, I have never found futures a very useful idiom in any > language (Scheme, Java, Python). Or more to the point, concurrency and > the notion of a function don't gel well in my mind. Interesting comment. It strik

Re: Throw the cat among the pigeons

2015-05-05 Thread Steven D'Aprano
On Sun, 3 May 2015 12:20 am, Cecil Westerhof wrote: [...] > But to my surprise tail recursion could even be more efficient. I > wrote two different versions of factorial with self implemented tail > recursion. For bigger values both are more efficient. And I expect > that if the tail recursion is

Re: Throw the cat among the pigeons

2015-05-05 Thread Chris Angelico
On Wed, May 6, 2015 at 12:57 PM, Steven D'Aprano wrote: > On Wed, 6 May 2015 05:42 am, Cecil Westerhof wrote: > >> I would say that a variable that is filled by a range is different as >> a normal variable. Do not ask me why. ;-) > > > I would say that you are wrong. If I have understood you corre

Re: CHALLENGE HELP - GOOGLE DEVELOPER DAY

2015-05-05 Thread John Ladasky
On Tuesday, May 5, 2015 at 4:59:51 PM UTC-7, Chris Angelico wrote: > On Wed, May 6, 2015 at 2:59 AM, wrote: > > Good afternoon everyone. > > > > I'm with the following exercise of the option is a modification of a google > > developer day exercise. > > > > SOMEONE HELP ME IN THIS CHALLENGE? > >

Re: Throw the cat among the pigeons

2015-05-05 Thread Steven D'Aprano
On Wed, 6 May 2015 05:42 am, Cecil Westerhof wrote: > I would say that a variable that is filled by a range is different as > a normal variable. Do not ask me why. ;-) I would say that you are wrong. If I have understood you correctly, that cannot possibly be the case in Python, all Python varia

Re: Throw the cat among the pigeons

2015-05-05 Thread Steven D'Aprano
On Wed, 6 May 2015 02:18 am, Cecil Westerhof wrote: > Well, I did not write many tail recursive functions. But what surprised > me was that for large values the ‘tail recursive’ version was more > efficient as the iterative version. And that was with myself > implementing the tail recursion. I exp

Re: Throw the cat among the pigeons

2015-05-05 Thread Steven D'Aprano
On Wed, 6 May 2015 07:23 am, Ian Kelly wrote: > On Tue, May 5, 2015 at 3:00 PM, Dave Angel wrote: >> def loop(func, funcname, arg): >> start = time.time() >> for i in range(repeats): >> func(arg, True) >> print("{0}({1}) took {2:7.4}".format(funcname, arg, >> time.time()-s

Re: Is it normal to cry when given XML?

2015-05-05 Thread Chris Angelico
On Wed, May 6, 2015 at 10:19 AM, Rustom Mody wrote: > On Wednesday, May 6, 2015 at 5:38:12 AM UTC+5:30, Chris Angelico wrote: >> On Wed, May 6, 2015 at 9:35 AM, Mark Lawrence wrote: >> > When the two young lads from the consultants I was working with back in >> > 2000 >> > found a bug with xml h

Re: Is it normal to cry when given XML?

2015-05-05 Thread Rustom Mody
On Wednesday, May 6, 2015 at 5:38:12 AM UTC+5:30, Chris Angelico wrote: > On Wed, May 6, 2015 at 9:35 AM, Mark Lawrence wrote: > > When the two young lads from the consultants I was working with back in 2000 > > found a bug with xml handling in the supplier's software I almost ended up > > in tear

Re: Beacon controller

2015-05-05 Thread Chris Angelico
On Wed, May 6, 2015 at 9:37 AM, wrote: > Hi, > I'm new to pyhton, can anyone suggest me how can I implement a DOS or DDOS > attack in Beacon Controller. > Thanks, > Manogna. http://www.catb.org/esr/faqs/hacker-howto.html#I_want_to_crack_and_Im_an_idiot ChrisA -- https://mail.python.org/mailma

Re: Is it normal to cry when given XML?

2015-05-05 Thread Chris Angelico
On Wed, May 6, 2015 at 9:35 AM, Mark Lawrence wrote: > When the two young lads from the consultants I was working with back in 2000 > found a bug with xml handling in the supplier's software I almost ended up > in tears. Why? They didn't bother reporting it, they simply modified all > their unit

Re: Stripping unencodable characters from a string

2015-05-05 Thread Chris Angelico
On Wed, May 6, 2015 at 4:19 AM, Paul Moore wrote: > I want to write a string to an already-open file (sys.stdout, typically). > However, I *don't* want encoding errors, and the string could be arbitrary > Unicode (in theory). The best way I've found is > > data = data.encode(file.encoding,

Re: CHALLENGE HELP - GOOGLE DEVELOPER DAY

2015-05-05 Thread Chris Angelico
On Wed, May 6, 2015 at 2:59 AM, wrote: > Good afternoon everyone. > > I'm with the following exercise of the option is a modification of a google > developer day exercise. > > SOMEONE HELP ME IN THIS CHALLENGE? You haven't posted any of your own code, so you're just asking for someone to do it

Beacon controller

2015-05-05 Thread bmanogna . 17
Hi, I'm new to pyhton, can anyone suggest me how can I implement a DOS or DDOS attack in Beacon Controller. Thanks, Manogna. -- https://mail.python.org/mailman/listinfo/python-list

Re: Is it normal to cry when given XML?

2015-05-05 Thread Mark Lawrence
On 05/05/2015 10:28, Sayth Renshaw wrote: Hi Just checking if the reaction to cry when given XML is normal. I thought maybe I am approaching it all wrong, using lxml largely or some xquery to club it into submission. See the usual goal is just to take the entire XML and push it into a databas

Re: Throw the cat among the pigeons

2015-05-05 Thread Terry Reedy
On 5/5/2015 5:12 PM, Cecil Westerhof wrote: Op Tuesday 5 May 2015 22:46 CEST schreef Terry Reedy: Well, I did not write many tail recursive functions. But what surprised me was that for large values the ‘tail recursive’ version was more efficient as the iterative version. In your first thread

PyPy Development: CFFI 1.0 beta 1

2015-05-05 Thread Mark Lawrence
Read all about it http://morepypy.blogspot.co.uk/2015/05/cffi-10-beta-1.html -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list

Re: Is it normal to cry when given XML?

2015-05-05 Thread Emile van Sebille
On 5/5/2015 9:54 AM, Michael Torrie wrote: On 05/05/2015 03:28 AM, Sayth Renshaw wrote: Hi Just checking if the reaction to cry when given XML is normal. I'd say it is normal. XML is like violence. If it doesn't solve your problems, you're not using enough of it[1]. [1] Can anyone tell me

Re: asyncio: What is the difference between tasks, futures, and coroutines?

2015-05-05 Thread Terry Reedy
On 5/5/2015 1:46 PM, Ian Kelly wrote: On Tue, May 5, 2015 at 9:22 AM, Paul Moore wrote: I'm working my way through the asyncio documentation. I have got to the "Tasks and coroutines" section, but I'm frankly confused as to the difference between the various things described in that section:

Re: Writing list of dictionaries to CSV

2015-05-05 Thread Tim Chase
On 2015-05-05 10:09, Kashif Rana wrote: > When I am writing list of dictionaries to CSV file, the key > 'schedule' has value 'Mar 2012' becomes Mar-12. How are you making this determination? Are you looking at the raw CSV output, or are you looking at the CSV file loaded into a spreadsheet like

Re: Throw the cat among the pigeons

2015-05-05 Thread Dave Angel
On 05/05/2015 05:39 PM, Ian Kelly wrote: On Tue, May 5, 2015 at 3:23 PM, Ian Kelly wrote: On Tue, May 5, 2015 at 3:00 PM, Dave Angel wrote: def loop(func, funcname, arg): start = time.time() for i in range(repeats): func(arg, True) print("{0}({1}) took {2:7.4}".format(

Re: Throw the cat among the pigeons

2015-05-05 Thread Ian Kelly
On Tue, May 5, 2015 at 3:23 PM, Ian Kelly wrote: > On Tue, May 5, 2015 at 3:00 PM, Dave Angel wrote: >> def loop(func, funcname, arg): >> start = time.time() >> for i in range(repeats): >> func(arg, True) >> print("{0}({1}) took {2:7.4}".format(funcname, arg, time.time()-start

Re: Throw the cat among the pigeons

2015-05-05 Thread Cecil Westerhof
Op Tuesday 5 May 2015 22:46 CEST schreef Terry Reedy: >> Well, I did not write many tail recursive functions. But what >> surprised me was that for large values the ‘tail recursive’ version >> was more efficient as the iterative version. > > In your first thread, what you mislabelled 'tail recursi

Re: Throw the cat among the pigeons

2015-05-05 Thread Ian Kelly
On Tue, May 5, 2015 at 3:00 PM, Dave Angel wrote: > def loop(func, funcname, arg): > start = time.time() > for i in range(repeats): > func(arg, True) > print("{0}({1}) took {2:7.4}".format(funcname, arg, time.time()-start)) > > start = time.time() > for i in range(repea

Re: Throw the cat among the pigeons

2015-05-05 Thread Dave Angel
On 05/05/2015 04:30 PM, Ian Kelly wrote: On Tue, May 5, 2015 at 12:45 PM, Dave Angel wrote: When the "simple" is True, the function takes noticeably and consistently longer. For example, it might take 116 instead of 109 seconds. For the same counts, your code took 111. I can't replicate thi

Re: Throw the cat among the pigeons

2015-05-05 Thread Terry Reedy
On 5/5/2015 12:18 PM, Cecil Westerhof wrote: Op Tuesday 5 May 2015 17:47 CEST schreef Paul Moore: On Sunday, 3 May 2015 16:23:59 UTC+1, Cecil Westerhof wrote: By the way: I think that even if the recursion does not go further as 500, it is still a good idea to use tail recursion. Why use stac

Re: Throw the cat among the pigeons

2015-05-05 Thread Ian Kelly
On Tue, May 5, 2015 at 12:45 PM, Dave Angel wrote: > When the "simple" is True, the function takes noticeably and consistently > longer. For example, it might take 116 instead of 109 seconds. For the > same counts, your code took 111. I can't replicate this. What version of Python is it, and wh

Re: Throw the cat among the pigeons

2015-05-05 Thread Cecil Westerhof
Op Tuesday 5 May 2015 20:45 CEST schreef Dave Angel: > On 05/05/2015 12:18 PM, Cecil Westerhof wrote: > >> >> Well, I did not write many tail recursive functions. But what >> surprised me was that for large values the ‘tail recursive’ version >> was more efficient as the iterative version. And tha

Re: Stripping unencodable characters from a string

2015-05-05 Thread Marko Rauhamaa
Paul Moore : > Nor can I - that's my point. But if all I have is an open text-mode > file with the "strict" error mode, I have to incur one encode, and I > have to make sure that no characters are passed to that encode which > can't be encoded. The file-like object you are given carries some bag

Re: Writing list of dictionaries to CSV

2015-05-05 Thread Matthew Ruffalo
On 2015-05-05 14:25, Skip Montanaro wrote: > More likely, viewing the CSV file in Excel, Gnumeric, or some other > spreadsheet which interprets some inputs as dates and formats them > according to its default rules. Skip This is depressingly common, and I've even received CSV and plain text data

Re: Stripping unencodable characters from a string

2015-05-05 Thread Jon Ribbens
On 2015-05-05, Paul Moore wrote: > I want to write a string to an already-open file (sys.stdout, > typically). However, I *don't* want encoding errors, and the string > could be arbitrary Unicode (in theory). The best way I've found is > > data = data.encode(file.encoding, errors='replace').de

Re: Stripping unencodable characters from a string

2015-05-05 Thread Paul Moore
On Tuesday, 5 May 2015 20:01:04 UTC+1, Dave Angel wrote: > On 05/05/2015 02:19 PM, Paul Moore wrote: > > You need to specify that you're using Python 3.4 (or whichever) when > starting a new thread. Sorry. 2.6, 2.7, and 3.3+. It's for use in a cross-version library. > If you're going to take c

Re: Writing list of dictionaries to CSV

2015-05-05 Thread Cecil Westerhof
Op Tuesday 5 May 2015 19:09 CEST schreef Kashif Rana: > When I am writing list of dictionaries to CSV file, the key > 'schedule' has value 'Mar 2012' becomes Mar-12. I really do not have > clue why thats happening. Below is the code. > > dic_1 = {'action': 'permit', 'dst-address': 'maxprddb-scan-1

Re: Stripping unencodable characters from a string

2015-05-05 Thread Dave Angel
On 05/05/2015 02:19 PM, Paul Moore wrote: You need to specify that you're using Python 3.4 (or whichever) when starting a new thread. I want to write a string to an already-open file (sys.stdout, typically). However, I *don't* want encoding errors, and the string could be arbitrary Unicode

Re: Throw the cat among the pigeons

2015-05-05 Thread Dave Angel
On 05/05/2015 12:18 PM, Cecil Westerhof wrote: Well, I did not write many tail recursive functions. But what surprised me was that for large values the ‘tail recursive’ version was more efficient as the iterative version. And that was with myself implementing the tail recursion. I expect the co

Re: Writing list of dictionaries to CSV

2015-05-05 Thread Skip Montanaro
On Tue, May 5, 2015 at 1:11 PM, MRAB wrote: > I'm assuming that you're reading the CSV file in a text editor, not > some other application that might be trying to be "clever" by > "interpreting" what it thinks looks a date as a date and then > displaying it differently... More likely, viewing the

Open a Url in new tab and tab switching in IE using python and selenium

2015-05-05 Thread shweta kaushik
Hi All, I am trying to open a new tab in IE10 and selenium 2.45. It is able to open a new tab using pyrobot. But when i am trying to open url in new tab, it is getting opened in first tab. Focus is not set to second tab and hence it is not working and also switching of tab is not working. please p

An improved version of the main snippet

2015-05-05 Thread Virgil Stokes
I have attached what I believe to be an improved version of my main snippet for testing. --V :-) ''' Purpose: get current bid, ask and rate for currency exchanges (FOREX trading) Note: 1. yahoo seems to give the best estimates for the currency exchange rates 2. Not sure where the "b

Stripping unencodable characters from a string

2015-05-05 Thread Paul Moore
I want to write a string to an already-open file (sys.stdout, typically). However, I *don't* want encoding errors, and the string could be arbitrary Unicode (in theory). The best way I've found is data = data.encode(file.encoding, errors='replace').decode(file.encoding) file.write(data)

Re: Writing list of dictionaries to CSV

2015-05-05 Thread MRAB
On 2015-05-05 18:09, Kashif Rana wrote: Hello Experts When I am writing list of dictionaries to CSV file, the key 'schedule' has value 'Mar 2012' becomes Mar-12. I really do not have clue why thats happening. Below is the code. dic_1 = {'action': 'permit', 'dst-address': 'maxprddb-scan-167,

Re: asyncio: What is the difference between tasks, futures, and coroutines?

2015-05-05 Thread Paul Moore
On Tuesday, 5 May 2015 18:48:09 UTC+1, Ian wrote: > Fundamentally, a future is a placeholder for something that isn't > available yet. You can use it to set a callback to be called when that > thing is available, and once it's available you can get that thing > from it. OK, that makes a lot of se

Re: asyncio: What is the difference between tasks, futures, and coroutines?

2015-05-05 Thread Paul Moore
On Tuesday, 5 May 2015 17:11:39 UTC+1, Zachary Ware wrote: >On Tue, May 5, 2015 at 10:22 AM, Paul Moore wrote: >> I'm working my way through the asyncio documentation. I have got to the >> "Tasks and coroutines" section, but I'm frankly confused as to the >> difference between the various things

Re: asyncio: What is the difference between tasks, futures, and coroutines?

2015-05-05 Thread Skip Montanaro
Paul> ... I'm frankly confused ... You and me both. I'm pretty sure I understand what a Future is, and until the long discussion about PEP 492 (?) started up, I thought I understood what a coroutine was from my days in school many years ago. Now I'm not so sure. Calling Dave Beazley... Calling Da

Re: asyncio: What is the difference between tasks, futures, and coroutines?

2015-05-05 Thread Marko Rauhamaa
Paul Moore : > But I don't understand what a Future is. A future stands for a function that is scheduled to execute in the background. Personally, I have never found futures a very useful idiom in any language (Scheme, Java, Python). Or more to the point, concurrency and the notion of a functio

Re: asyncio: What is the difference between tasks, futures, and coroutines?

2015-05-05 Thread Ian Kelly
On Tue, May 5, 2015 at 9:22 AM, Paul Moore wrote: > I'm working my way through the asyncio documentation. I have got to the > "Tasks and coroutines" section, but I'm frankly confused as to the difference > between the various things described in that section: coroutines, tasks, and > futures.

Re: asyncio: What is the difference between tasks, futures, and coroutines?

2015-05-05 Thread Terry Reedy
On 5/5/2015 11:22 AM, Paul Moore wrote: I'm working my way through the asyncio documentation. I have got to the "Tasks and coroutines" section, but I'm frankly confused as to the difference between the various things described in that section: coroutines, tasks, and futures. I think can understa

Re: Step further with filebasedMessages

2015-05-05 Thread Dave Angel
On 05/05/2015 11:25 AM, Cecil Westerhof wrote: I have a file with quotes and a file with tips. I want to place random messages from those two (without them being repeated to soon) on my Twitter page. This I do with ‘get_random_message’. I also want to put the first message of another file and r

Writing list of dictionaries to CSV

2015-05-05 Thread Kashif Rana
Hello Experts When I am writing list of dictionaries to CSV file, the key 'schedule' has value 'Mar 2012' becomes Mar-12. I really do not have clue why thats happening. Below is the code. dic_1 = {'action': 'permit', 'dst-address': 'maxprddb-scan-167, maxprddb-scan-168, maxprddb-scan-169', '

Re: Is it normal to cry when given XML?

2015-05-05 Thread Grant Edwards
On 2015-05-05, Sayth Renshaw wrote: > Just checking if the reaction to cry when given XML is normal. It depends on whether or not you're allowed to swear and throw things. -- Grant Edwards grant.b.edwardsYow! I just heard the at

CHALLENGE HELP - GOOGLE DEVELOPER DAY

2015-05-05 Thread worship . brother
Good afternoon everyone. I'm with the following exercise of the option is a modification of a google developer day exercise. SOMEONE HELP ME IN THIS CHALLENGE? Archaeologists have found a scroll with the following texts: txtA = '' 'cncdbm pjcjzct vdbbxdtw rfqsr mkt gvhkcsvw qcxr kmk pnhc zwwds

Re: Is it normal to cry when given XML?

2015-05-05 Thread Michael Torrie
On 05/05/2015 03:28 AM, Sayth Renshaw wrote: > Hi > > Just checking if the reaction to cry when given XML is normal. I'd say it is normal. XML is like violence. If it doesn't solve your problems, you're not using enough of it[1]. [1] Can anyone tell me who originated this line? -- https://mai

Re: Throw the cat among the pigeons

2015-05-05 Thread Cecil Westerhof
Op Tuesday 5 May 2015 17:47 CEST schreef Paul Moore: > On Sunday, 3 May 2015 16:23:59 UTC+1, Cecil Westerhof wrote: >>> By the way: I think that even if the recursion does not go further >>> as 500, it is still a good idea to use tail recursion. Why use >>> stack space when it is not necessary? >

Re: Bitten by my C/Java experience

2015-05-05 Thread Rustom Mody
On Tuesday, May 5, 2015 at 6:50:29 PM UTC+5:30, BartC wrote: > On 05/05/2015 09:19, Steven D'Aprano wrote: > > On Tuesday 05 May 2015 08:02, BartC wrote: > > >> (I think I would have picked up "++" and "--" as special tokens even if > >> increment/decrement ops weren't supported. Just because they

Re: asyncio: What is the difference between tasks, futures, and coroutines?

2015-05-05 Thread Zachary Ware
On Tue, May 5, 2015 at 10:22 AM, Paul Moore wrote: > I'm working my way through the asyncio documentation. I have got to the > "Tasks and coroutines" section, but I'm frankly confused as to the difference > between the various things described in that section: coroutines, tasks, and > futures.

Re: Throw the cat among the pigeons

2015-05-05 Thread Paul Moore
On Sunday, 3 May 2015 16:23:59 UTC+1, Cecil Westerhof wrote: > > By the way: I think that even if the recursion does not go further > > as 500, it is still a good idea to use tail recursion. Why use stack > > space when it is not necessary? > > I pushed the example to GitHub: > https://github

Re: Step further with filebasedMessages

2015-05-05 Thread Cecil Westerhof
Op Tuesday 5 May 2015 13:08 CEST schreef Peter Otten: > Cecil Westerhof wrote: > >> I now defined get_message_slice: >> ### Add step >> def get_message_slice(message_filename, start, end): > > Intervals are usually half-open in Python. I recommend that you > follow that convention. I will change

asyncio: What is the difference between tasks, futures, and coroutines?

2015-05-05 Thread Paul Moore
I'm working my way through the asyncio documentation. I have got to the "Tasks and coroutines" section, but I'm frankly confused as to the difference between the various things described in that section: coroutines, tasks, and futures. I think can understand a coroutine. Correct me if I'm wrong,

Re: Step further with filebasedMessages

2015-05-05 Thread Cecil Westerhof
Op Tuesday 5 May 2015 15:57 CEST schreef Ian Kelly: > On May 5, 2015 5:46 AM, "Cecil Westerhof" wrote: >> >> Op Tuesday 5 May 2015 12:41 CEST schreef Steven D'Aprano: >> >>> # Untested. def get_message_slice(message_filename, start=0, >>> end=None, step=1): real_file = expanduser(message_filename

Re: Step further with filebasedMessages

2015-05-05 Thread Ian Kelly
On May 5, 2015 5:46 AM, "Cecil Westerhof" wrote: > > Op Tuesday 5 May 2015 12:41 CEST schreef Steven D'Aprano: > > > # Untested. > > def get_message_slice(message_filename, start=0, end=None, step=1): > > real_file = expanduser(message_filename) > > messages = [] > > # FIXME: I assume this is expe

Re: Bitten by my C/Java experience

2015-05-05 Thread BartC
On 05/05/2015 09:19, Steven D'Aprano wrote: On Tuesday 05 May 2015 08:02, BartC wrote: (I think I would have picked up "++" and "--" as special tokens even if increment/decrement ops weren't supported. Just because they would likely cause errors through misunderstanding.) Just because C made

Re: Is it normal to cry when given XML?

2015-05-05 Thread Tim
On Tuesday, May 5, 2015 at 5:28:37 AM UTC-4, Sayth Renshaw wrote: > Hi > > Just checking if the reaction to cry when given XML is normal. > > Sayth Hi Sayth, My experience in general is just like what Chris said. Except when dealing with DocBook XML which is probably not what you have. But I c

Re: Is it normal to cry when given XML?

2015-05-05 Thread Sayth Renshaw
Adam I am glad to hear it in someways because it's something I have never heard it. For a person relatively new to XML most articles and tutorials demonstrate getting it out to a more "manageable" format. I had been using xbase to inspect the data and query but really ask I want to do was push

Re: Step further with filebasedMessages

2015-05-05 Thread Cecil Westerhof
Op Tuesday 5 May 2015 12:41 CEST schreef Steven D'Aprano: > On Tuesday 05 May 2015 18:52, Cecil Westerhof wrote: > >> I now defined get_message_slice: >> ### Add step >> def get_message_slice(message_filename, start, end): >> """ >> Get a slice of messages, where 0 is the first message >> Works wi

Re: Exception in thread Thread-4:

2015-05-05 Thread david jhon
Hi Chris, Thanks a lot for such a comprehensive reply, I got it fixed now. Thanks again :) On Tue, May 5, 2015 at 2:52 PM, Chris Angelico wrote: > On Tue, May 5, 2015 at 7:23 PM, david jhon wrote: > > from threading import Timer, Lock > > > > class miTestClass(EventMixin): > > def __init__

Re: Step further with filebasedMessages

2015-05-05 Thread Peter Otten
Cecil Westerhof wrote: > I now defined get_message_slice: > ### Add step > def get_message_slice(message_filename, start, end): Intervals are usually half-open in Python. I recommend that you follow that convention. > """ > Get a slice of messages, where 0 is the first m

Re: when does newlines get set in universal newlines mode?

2015-05-05 Thread Davide Mancusi
> Cool. I suggest posting in the tracker thread the exact Python > version(s) you've tested this with, in case it matters. Done. Good point. -- https://mail.python.org/mailman/listinfo/python-list

Re: Step further with filebasedMessages

2015-05-05 Thread Cecil Westerhof
Op Tuesday 5 May 2015 11:20 CEST schreef Chris Angelico: > On Tue, May 5, 2015 at 6:52 PM, Cecil Westerhof wrote: >> I now defined get_message_slice: > > You're doing a lot of work involving flat-file storage of sequential > data. There are two possibilities: > > 1) Your files are small, so you s

Re: Step further with filebasedMessages

2015-05-05 Thread Steven D'Aprano
On Tuesday 05 May 2015 18:52, Cecil Westerhof wrote: > I now defined get_message_slice: > ### Add step > def get_message_slice(message_filename, start, end): > """ > Get a slice of messages, where 0 is the first message > Works with negative indexes > The va

Re: Is it normal to cry when given XML?

2015-05-05 Thread Adam Tauno Williams
On Tue, 2015-05-05 at 02:28 -0700, Sayth Renshaw wrote: > Just checking if the reaction to cry when given XML is normal. No, not at all. I leap for ecstatic joy when given, as all to rarely happens, XML. Rather than someone's turdy text [which includes JSON] file. I wish all 1,200+ of my vendo

Re: GAE environment differences

2015-05-05 Thread Robin Becker
On 02/05/2015 10:14, Kev Dwyer wrote: Robin Becker wrote: ``` the user suggests that even though claims are made that you can use a filesystem, but stuff like pwd is missing. Apparently the user module has no meaning, but there is a users module? I guess I'll need to keep patchin

Re: Is it normal to cry when given XML?

2015-05-05 Thread Steven D'Aprano
On Tuesday 05 May 2015 19:28, Sayth Renshaw wrote: > Just checking if the reaction to cry when given XML is normal. Cry? When people give me XML, sometimes I lose control of my bladder. -- Steve -- https://mail.python.org/mailman/listinfo/python-list

Re: Exception in thread Thread-4:

2015-05-05 Thread Chris Angelico
On Tue, May 5, 2015 at 7:23 PM, david jhon wrote: > from threading import Timer, Lock > > class miTestClass(EventMixin): > def __init__(self, t, r, bw): > self.statMonitorLock = Lock() #to lock the multi access threads > self.statMonitorLock.acquire() > statMonitorTi

Re: Is it normal to cry when given XML?

2015-05-05 Thread Chris Angelico
On Tue, May 5, 2015 at 7:28 PM, Sayth Renshaw wrote: > Hi > > Just checking if the reaction to cry when given XML is normal. It's not unsurprising, especially with bad XML structures. > I thought maybe I am approaching it all wrong, using lxml largely or some > xquery to club it into submission

Exception in thread Thread-4:

2015-05-05 Thread david jhon
Hello everyone, I am initializing lock and threading related variables in __init__() method of the class as follows: from threading import Timer, Lock class miTestClass(EventMixin): def __init__(self, t, r, bw): self.statMonitorLock = Lock() #to lock the multi access threads

Is it normal to cry when given XML?

2015-05-05 Thread Sayth Renshaw
Hi Just checking if the reaction to cry when given XML is normal. I thought maybe I am approaching it all wrong, using lxml largely or some xquery to club it into submission. See the usual goal is just to take the entire XML and push it into a database. or in future experiment with Mongo or

Re: when does newlines get set in universal newlines mode?

2015-05-05 Thread Chris Angelico
On Tue, May 5, 2015 at 7:23 PM, Davide Mancusi wrote: > I just opened a bug report: > > http://bugs.python.org/issue24126 > > We'll see what they say. Cool. I suggest posting in the tracker thread the exact Python version(s) you've tested this with, in case it matters. ChrisA -- https://mail.py

Re: when does newlines get set in universal newlines mode?

2015-05-05 Thread Davide Mancusi
I just opened a bug report: http://bugs.python.org/issue24126 We'll see what they say. -- https://mail.python.org/mailman/listinfo/python-list

Re: Step further with filebasedMessages

2015-05-05 Thread Chris Angelico
On Tue, May 5, 2015 at 6:52 PM, Cecil Westerhof wrote: > I now defined get_message_slice: You're doing a lot of work involving flat-file storage of sequential data. There are two possibilities: 1) Your files are small, so you shouldn't concern yourself with details at all - just do whatever look

Step further with filebasedMessages

2015-05-05 Thread Cecil Westerhof
I now defined get_message_slice: ### Add step def get_message_slice(message_filename, start, end): """ Get a slice of messages, where 0 is the first message Works with negative indexes The values can be ascending and descending """ message_li

Re: when does newlines get set in universal newlines mode?

2015-05-05 Thread Chris Angelico
On Tue, May 5, 2015 at 6:31 PM, Steven D'Aprano wrote: > On Monday 04 May 2015 22:13, Chris Angelico wrote: > >> It may be worth documenting this limitation, but it's not something >> that can easily be fixed without removing support for \r newlines - >> although that might be an option, given tha

Re: when does newlines get set in universal newlines mode?

2015-05-05 Thread Steven D'Aprano
On Monday 04 May 2015 22:13, Chris Angelico wrote: > It may be worth documenting this limitation, but it's not something > that can easily be fixed without removing support for \r newlines - > although that might be an option, given that non-OSX Macs are > basically history now. Non-OSX Macs are

Re: Bitten by my C/Java experience

2015-05-05 Thread Steven D'Aprano
On Tuesday 05 May 2015 08:02, BartC wrote: > On 04/05/2015 16:20, Cecil Westerhof wrote: >> Potential dangerous bug introduced by programming in Python as if it >> was C/Java. :-( >> I used: >> ++tries >> that has to be: >> tries += 1 > > I think I've come across that. It doesn't mind +