How can i get http body??

2014-07-09 Thread Frank Liou
https://lh5.googleusercontent.com/-6t5tmr5T4Ys/U74FdF128oI/Bvo/bYyaHzsdw9Q/s1600/%E6%9C%AA%E5%91%BD%E5%90%8D.jpg how can i catch the "body" when i was post ?? i want to catch body to my database and encode to base64 def hello(username): if request.method=='POST': pos

Re: NaN comparisons - Call For Anecdotes

2014-07-09 Thread Rustom Mody
On Tuesday, July 8, 2014 8:23:47 PM UTC+5:30, Anders J. Munch wrote: > Most people don't need to deal with NaN's in Python at all, > fortunately. They just don't appear in normal computation, because the > interpreter raises an exception instead. > So I make this claim: float.__eq__ implementing I

Re: Proposal: === and !=== operators

2014-07-09 Thread Steven D'Aprano
On Wed, 09 Jul 2014 13:05:22 -0500, Tim Chase wrote: > If you want to compare things in a NaN-aware way, you can either spell > it out explicitly: > > if x == y or (math.isnan(x) and math.isnan(y)): > do_stuff() But do we really want any arbitrary NAN to compare equal-ish with every other

Re: NaN comparisons - Call For Anecdotes

2014-07-09 Thread Ben Finney
"Anders J. Munch" <2...@jmunch.dk> writes: > Joel Goldstick wrote: > > I've been following along here, and it seems you haven't received > > the answer you want or need. > > So far I received exactly the answer I was expecting. 0 examples of > NaN!=NaN being beneficial. Predictability and ease of

Re: Writing Python File at Specific Interval

2014-07-09 Thread Denis McMahon
On Wed, 09 Jul 2014 07:36:49 -0700, subhabangalore wrote: > The code (a basic crawler) would run every morning or evening, on a > predefined time. [This part is fine]. > > In the next part, I am trying to store the daily results to a new file. So what you want to do is store each day's results i

Re: NaN comparisons - Call For Anecdotes

2014-07-09 Thread Ethan Furman
On 07/09/2014 04:03 PM, Anders J. Munch wrote: Joel Goldstick wrote: I've been following along here, and it seems you haven't received the answer you want or need. So far I received exactly the answer I was expecting. 0 examples of NaN!=NaN being beneficial. python-list (in whichever fro

Re: NaN comparisons - Call For Anecdotes

2014-07-09 Thread Ian Kelly
On Wed, Jul 9, 2014 at 5:03 PM, Anders J. Munch <2...@jmunch.dk> wrote: > Joel Goldstick wrote: >> >> I've been following along here, and it seems you haven't received the >> answer you want or need. > > > So far I received exactly the answer I was expecting. 0 examples of > NaN!=NaN being benefic

Re: Proposal: === and !=== operators

2014-07-09 Thread Cameron Simpson
TL;DR: I've got an alternative proposal at the bottom of this message. On 09Jul2014 09:17, Steven D'Aprano wrote: On Wed, 09 Jul 2014 17:21:20 +1000, Chris Angelico wrote: First thought: It will just add confusion. Currently, there are small pockets of confusion surrounding the few cases where

Re: NaN comparisons - Call For Anecdotes

2014-07-09 Thread Anders J. Munch
Joel Goldstick wrote: I've been following along here, and it seems you haven't received the answer you want or need. So far I received exactly the answer I was expecting. 0 examples of NaN!=NaN being beneficial. I wasn't asking for help, I was making a point. Whether that will lead to impro

Re: NaN comparisons - Call For Anecdotes

2014-07-09 Thread Ethan Furman
On 07/09/2014 02:09 PM, Anders J. Munch wrote: Ethan Furman: I would suggest you ask for this on the numerical mailing lists instead of here -- and you may not want to offer a beer to everyone that has an anecdote for NaN behavior being useful. I don't have time to start this discussion over

Re: NaN comparisons - Call For Anecdotes

2014-07-09 Thread Joel Goldstick
On Wed, Jul 9, 2014 at 5:09 PM, Anders J. Munch <2...@jmunch.dk> wrote: > Ethan Furman: > > I would suggest you ask for this on the numerical mailing lists instead >> of here -- and you may not want to offer a beer to everyone that has an >> anecdote for NaN behavior being useful. >> > I don't ha

Re: NaN comparisons - Call For Anecdotes

2014-07-09 Thread Anders J. Munch
Ethan Furman: I would suggest you ask for this on the numerical mailing lists instead of here -- and you may not want to offer a beer to everyone that has an anecdote for NaN behavior being useful. I don't have time to start this discussion over again on another mailing list. Don't anyone on th

Re: Proposal: === and !=== operators

2014-07-09 Thread Roy Smith
In article <53bd3a1d$0$29995$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > On Wed, 09 Jul 2014 08:27:28 -0400, Roy Smith wrote: > > > We would have *three* ways to compare for equality (==, ===, and is). > > `is` does not, never has, and never will, be a test for equality. > >

Re: error handling when opening files

2014-07-09 Thread Alex Burke
> Interestingly, did you know that even *closing* a file can fail? No I didn't, interesting piece on information for sure! I thought close() is usually made to always succeed regardless if it actually hosed up. Any idea what the context manager will do in that case? (I ask as that else-with form l

Re: error handling when opening files

2014-07-09 Thread Alex Burke
> If that's what you're expecting, then your message is wrong, because > you say "file never opened" - but you possibly DID open it, and maybe > read something from it. The choice between the two forms should be > based on whether you want to distinguish between errors on opening and > errors on re

Re: Writing Python File at Specific Interval

2014-07-09 Thread Shubham Tomar
Hi Subhabrata, You can use open(name, 'w'), which creates the file if the file does not exist, but it will truncate the existing file. Alternatively, you can use open(name, 'a'); this will create the file if the file does not exist, but will not truncate the existing file. Ref.: open()

Re: Writing Python File at Specific Interval

2014-07-09 Thread Abhiram R
Looping in the list to improve on my suggestion or suggest an alternative On Wed, Jul 9, 2014 at 11:03 PM, Abhiram R wrote: > Hi Subha, > What is the current methodology you're using? If your code is already > being called every 24 hours or whatever, you can use a "touch" command > inside an os

Re: Entreprise level python tcp server

2014-07-09 Thread Terry Reedy
> On 7/9/2014 3:36 AM, Arulnambi Nandagoban wrote: >> I like to convert the python script to windows application. The proper way to do asynchronous io on Windows is quite different from the proper way to do it on posix systems (more or less everything other than Windows). If you plan on using

Re:Writing Python File at Specific Interval

2014-07-09 Thread Dave Angel
subhabangal...@gmail.com Wrote in message: > > > In the next part, I am trying to store the daily > results to a new file. > > As I researched I found some tips around time module, > logging module, pythoncom etc. But not getting any important > lead. > What exactly is the problem? Perhaps y

Re: Help me write better Code

2014-07-09 Thread Terry Reedy
On 7/9/2014 10:27 AM, sssdevelop wrote: Hello, I have working code - but looking for better/improved code. Better coding practices, better algorithm :) Problem: Given sequence of increasing integers, print blocks of consecutive integers. Input: [51, 53, 55, 67, 68, 91, 92, 93, 94, 99] Outo

Re: Proposal: === and !=== operators

2014-07-09 Thread Ian Kelly
On Wed, Jul 9, 2014 at 12:05 PM, Tim Chase wrote: > def equalish(x, y): >return x == y or (math.isnan(x) and math.isnan(y)) With more generality: def nan_type(x): if isinstance(x, numbers.Complex): if cmath.isnan(x): return 'qnan' elif isinstance(x, decimal.Decimal):

Re: Help me write better Code

2014-07-09 Thread Ian Kelly
On Wed, Jul 9, 2014 at 8:27 AM, sssdevelop wrote: > prev = 0 > blocks = [] > tmp = [] > last = 0 > for element in a: >if prev == 0: Is 0 allowed to be in the input list? What would happen if it were? > next This line doesn't do anything. It looks up the builtin function named next an

Re: Proposal: === and !=== operators

2014-07-09 Thread Tim Chase
On 2014-07-09 12:48, Steven D'Aprano wrote: > On Wed, 09 Jul 2014 08:27:28 -0400, Roy Smith wrote: > > > We would have *three* ways to compare for equality (==, ===, and > > is). > > `is` does not, never has, and never will, be a test for equality. > > py> x = [] > py> y = [] > py> x is y > Fals

Re: Proposal: === and !=== operators

2014-07-09 Thread Ian Kelly
On Wed, Jul 9, 2014 at 3:17 AM, Steven D'Aprano wrote: > People are already having problems, just listen to Anders. He's > (apparently) not doing NAN-aware computations on his data, he just wants > to be able to do something like > > this_list_of_floats == that_list_of_floats > > without NANs scre

Re: NaN comparisons - Call For Anecdotes

2014-07-09 Thread Anders J. Munch
Steven D'Aprano wrote: I assumed that you realised that the 64-bit(?) values you were receiving in binary could be interpreted as ints. After all, you have to unpack them from some bytes. Since that's not what you're doing, I have no idea what it is. Stop obsessing over how NaN's came to exi

Re: NaN comparisons - Call For Anecdotes

2014-07-09 Thread Ian Kelly
On Wed, Jul 9, 2014 at 10:53 AM, Steven D'Aprano > Cast your 64-bit float into a 64-bit int. Or, if it's a C single rather > than a double, cast the 32-bit float into a 32-bit int. Now you can > compare them for equality without carrying about NANs, and without losing > data. Later, when you're rea

Re: Entreprise level python tcp server

2014-07-09 Thread Emile van Sebille
EVE online uses stackless python (http://highscalability.com/eve-online-architecture) and has seen a max of some 40k simultaneous users. You might want to look into how they do it. Emile On 7/9/2014 3:36 AM, Arulnambi Nandagoban wrote: Hello all, Can anyone tell me the reliability level of

Re: NaN comparisons - Call For Anecdotes

2014-07-09 Thread Steven D'Aprano
On Wed, 09 Jul 2014 17:08:15 +0200, Anders J. Munch wrote: > Steven D'Aprano wrote: >> It seems to me that the trivial work-around is: >> >> * gather packed floats from some device, as ints * process them *as >> ints* in some way which requires reflexivity * unpack back into floats >> * (maybe) mu

Re: NaN comparisons - Call For Anecdotes

2014-07-09 Thread Ethan Furman
On 07/08/2014 07:53 AM, Anders J. Munch wrote: So I make this claim: float.__eq__ implementing IEEE-754 NaN comparison rules creates real problems for developers. And it has never, ever, helped anyone do anything. "Never" is a strong claim, and easily disproven if false: Simply provide a counte

Re: NaN comparisons - Call For Anecdotes

2014-07-09 Thread Anders J. Munch
Chris Angelico: If you need to do bitwise comparisons, then the easiest way is to use the bitpattern, converted to an integer. A 64-bit float becomes a 64-bit integer. It's then very simple to compare them, and reflexivity is maintained. At what point do you actually need them to be floats? What

Re: Proposal: === and !=== operators

2014-07-09 Thread Rustom Mody
On Wednesday, July 9, 2014 2:47:40 PM UTC+5:30, Steven D'Aprano wrote: > On Wed, 09 Jul 2014 17:21:20 +1000, Chris Angelico wrote: > > wrote: > >> Thoughts? Comments? > > First thought: It will just add confusion. Currently, there are small > > pockets of confusion surrounding the few cases where

Re: Help me write better Code

2014-07-09 Thread Mark Lawrence
On 09/07/2014 15:27, sssdevelop wrote: Hello, I have working code - but looking for better/improved code. Better coding practices, better algorithm :) Problem: Given sequence of increasing integers, print blocks of consecutive integers. Example: Input: [10, 11, 12, 15] Output: [10, 11, 12]

Re: Proposal: === and !=== operators

2014-07-09 Thread Robert Kern
On 2014-07-09 08:00, Steven D'Aprano wrote: At the moment, Python has two (in)equality operators, == and != which call __eq__ and __ne__ methods. Some problems with those: * Many people expect == to always be reflexive (that is, x == x for every x) but classes which customise __eq__ may not

Re: NaN comparisons - Call For Anecdotes

2014-07-09 Thread Chris Angelico
On Thu, Jul 10, 2014 at 1:08 AM, Anders J. Munch <2...@jmunch.dk> wrote: > Steven D'Aprano wrote: >> >> It seems to me that the trivial work-around is: >> >> * gather packed floats from some device, as ints >> * process them *as ints* in some way which requires reflexivity >> * unpack back into flo

Re: NaN comparisons - Call For Anecdotes

2014-07-09 Thread Anders J. Munch
Steven D'Aprano wrote: It seems to me that the trivial work-around is: * gather packed floats from some device, as ints * process them *as ints* in some way which requires reflexivity * unpack back into floats * (maybe) much later perform numeric calculations on them Although perhaps I don't u

Re: NaN comparisons - Call For Anecdotes

2014-07-09 Thread Anders J. Munch
I wrote: | class Monitor(Thread): | def run(self): | old = self.get_current_value() | while not self.Terminated: | new = self.get_current_value() | if new != old: | print(time.asctime(), "changed to", new) | old = new | time.sleep(1) Huh, I don't know what happened to the identation here, I'l

Writing Python File at Specific Interval

2014-07-09 Thread subhabangalore
Dear Group, I am trying to write a file, which would create a new file name as the code runs. The code (a basic crawler) would run every morning or evening, on a predefined time. [This part is fine]. In the next part, I am trying to store the daily results to a new file. As I researched I

Help me write better Code

2014-07-09 Thread sssdevelop
Hello, I have working code - but looking for better/improved code. Better coding practices, better algorithm :) Problem: Given sequence of increasing integers, print blocks of consecutive integers. Example: Input: [10, 11, 12, 15] Output: [10, 11, 12] Input: [51, 53, 55, 67, 68, 91, 92, 9

Re: Does python support ATL Modelling Language?

2014-07-09 Thread William Ray Wing
On Jul 9, 2014, at 4:38 AM, varun bhatnagar wrote: > Hi, > > I am trying to shift my application from JAVA to Python and in JAVA I am > using ATL Transformations (modelling techniques). Is it possible to do that > with Python, does python support ATL Transformations. If not is there any > API

Re: Does python support ATL Modelling Language?

2014-07-09 Thread varun bhatnagar
Thanks a lot William for the reply! Before writing the previous mail I did a search but I was not able to find anything which can fulfill my need. I want something where in I can define certain rules for my xml and based on those rules my xmls should get merged into another xml (probably XSLT, stil

Re: Proposal: === and !=== operators

2014-07-09 Thread Ethan Furman
On 07/09/2014 12:00 AM, Steven D'Aprano wrote: I propose: [adding new operators] -1 Too much added confusion, too little gain. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: Proposal: === and !=== operators

2014-07-09 Thread Steven D'Aprano
On Wed, 09 Jul 2014 08:27:28 -0400, Roy Smith wrote: > We would have *three* ways to compare for equality (==, ===, and is). `is` does not, never has, and never will, be a test for equality. py> x = [] py> y = [] py> x is y False -- Steven -- https://mail.python.org/mailman/listinfo/python-

Re: Proposal: === and !=== operators

2014-07-09 Thread Roy Smith
In article <53bce8a3$0$2746$c3e8da3$76491...@news.astraweb.com>, Steven D'Aprano wrote: > At the moment, Python has two (in)equality operators, == and != which > call __eq__ and __ne__ methods. Some problems with those: > > > * Many people expect == to always be reflexive (that is, x == x for

Re: Proposal: === and !=== operators

2014-07-09 Thread Devin Jeanpierre
On Wed, Jul 9, 2014 at 12:00 AM, Steven D'Aprano wrote: > At the moment, Python has two (in)equality operators, == and != which > call __eq__ and __ne__ methods. Some problems with those: > > > * Many people expect == to always be reflexive (that is, x == x for > every x) but classes which custo

Re: Entreprise level python tcp server

2014-07-09 Thread INADA Naoki
I +1 on Tornado. Here is echo server in some languages and frameworks. https://github.com/methane/echoserver # Benchmark is very outdated. Go is now very faster than before. On Wed, Jul 9, 2014 at 7:36 PM, Arulnambi Nandagoban wrote: > Hello all, > > > > Can anyone tell me the reliability level

Entreprise level python tcp server

2014-07-09 Thread Arulnambi Nandagoban
Hello all, Can anyone tell me the reliability level of python server in enterprise application ? I already developed a tcp server in python as a prototype. Our requirement for tcp server to handle more than 1 connection simultaneously . Since, I am the only python fanatic in my company, i

Does python support ATL Modelling Language?

2014-07-09 Thread varun bhatnagar
Hi, I am trying to shift my application from JAVA to Python and in JAVA I am using ATL Transformations (modelling techniques). Is it possible to do that with Python, does python support ATL Transformations. If not is there any API/library/module which supports this? Any kind of help will be appre

Re: Proposal: === and !=== operators

2014-07-09 Thread Chris Angelico
On Wed, Jul 9, 2014 at 7:02 PM, Steven D'Aprano wrote: > If you can tell the difference between x=y and x==y you should be able to > also distinguish x===y. But I accept that it's a little sub-optimal. I'm not bothered so much by the "which one is this" confusion as the "which should this be" con

Re: Proposal: === and !=== operators

2014-07-09 Thread Steven D'Aprano
On Wed, 09 Jul 2014 17:21:20 +1000, Chris Angelico wrote: > On Wed, Jul 9, 2014 at 5:00 PM, Steven D'Aprano > wrote: >> Thoughts? Comments? > > First thought: It will just add confusion. Currently, there are small > pockets of confusion surrounding the few cases where something's > non-reflexive

Re: Proposal: === and !=== operators

2014-07-09 Thread Steven D'Aprano
On Wed, 09 Jul 2014 18:17:23 +1000, Cameron Simpson wrote: > On 09Jul2014 07:00, Steven D'Aprano wrote: >>At the moment, Python has two (in)equality operators, == and != which >>call __eq__ and __ne__ methods. Some problems with those: >> >>* Many people expect == to always be reflexive (that is,

Re: Proposal: === and !=== operators

2014-07-09 Thread Cameron Simpson
On 09Jul2014 07:00, Steven D'Aprano wrote: At the moment, Python has two (in)equality operators, == and != which call __eq__ and __ne__ methods. Some problems with those: * Many people expect == to always be reflexive (that is, x == x for every x) but classes which customise __eq__ may not be.

Re: same code same tables but not the same result(use flask and postgres)

2014-07-09 Thread Frank Liou
oh by the way one of database version is postgres 80420 another is 90304 80420 is fine but 90304 is so strange -- https://mail.python.org/mailman/listinfo/python-list

ANN: eGenix mxODBC 3.3.1 - Python ODBC Database Interface

2014-07-09 Thread eGenix Team: M.-A. Lemburg
ANNOUNCING eGenix.com mxODBC Python ODBC Database Interface Version 3.3.1 mxODBC is our commercially supported Python extension providing

Re: same code same tables but not the same result(use flask and postgres)

2014-07-09 Thread Frank Liou
Hi ChrisA i use same workspace all the same python 3.3 -- https://mail.python.org/mailman/listinfo/python-list

[ANN] pyspread 0.3.0

2014-07-09 Thread Martin Manns
== pyspread 0.3.0 == Pyspread 0.3.0 is released. This update is the first release that runs with wxPython 3.x. About pyspread == Pyspread is a non-traditional spreadsheet application that is based on and written in the programming language Python. The goa

Re: same code same tables but not the same result(use flask and postgres)

2014-07-09 Thread Chris Angelico
On Wed, Jul 9, 2014 at 5:14 PM, Frank Liou wrote: > one i got > > MTIzNDU2Nzg= <==it's right > > anoter i got > > \x4d54497a4e4455324e7a673d Encode that string as ASCII and represent the bytes in hexadecimal, and you get the second one. My guess is that maybe you have one of them running Python

Re: Proposal: === and !=== operators

2014-07-09 Thread Chris Angelico
On Wed, Jul 9, 2014 at 5:00 PM, Steven D'Aprano wrote: > Thoughts? Comments? First thought: It will just add confusion. Currently, there are small pockets of confusion surrounding the few cases where something's non-reflexive, and there are occasional threads on the subject, like we have now. Add

same code same tables but not the same result(use flask and postgres)

2014-07-09 Thread Frank Liou
i use flask connect to postgres def post_insert(username): conn = engine.connect() encoded = base64.b64encode(username.encode('utf-8')) puresql = sqla.text("INSERT INTO friends(name) VALUES(:encoded)") conn.execute(puresql,encoded = encoded) i insert username encode with base64 t

Proposal: === and !=== operators

2014-07-09 Thread Steven D'Aprano
At the moment, Python has two (in)equality operators, == and != which call __eq__ and __ne__ methods. Some problems with those: * Many people expect == to always be reflexive (that is, x == x for every x) but classes which customise __eq__ may not be. * The == operator requires __eq__ to ret