Re: So, what's the real story on Python 2 vs Python 3?

2013-12-26 Thread Dan Stromberg
On Thu, Dec 26, 2013 at 9:43 PM, Rustom Mody wrote: > On Fri, Dec 27, 2013 at 10:50 AM, Andrew Berg wrote: > As for 2 maybe we need a wiki page. (Or do we have one already?) > Heres my largely ignoramus attempt at starting that: > > 1. print: Use print with (). Dont use funny 2 syntax. In fact,

Brython (Python in the browser)

2013-12-26 Thread Pierre Quentel
Hi, Ever wanted to use Python instead of Javascript for web client programming ? Take a look at Brython, an implementation of Python 3 in the browser, with an interface with DOM elements and events Its use is very simple : - load the Javascript library brython.js :

Re: So, what's the real story on Python 2 vs Python 3?

2013-12-26 Thread Chris Angelico
On Fri, Dec 27, 2013 at 4:43 PM, Rustom Mody wrote: > 1. print: Use print with (). Dont use funny 2 syntax > 2. Always write strings with a u" prefix > 3. Always use new style classes > 4. Always use relative imports with explicit relative (ie use .) Even easier: 1. from __future__ import print_

Re: So, what's the real story on Python 2 vs Python 3?

2013-12-26 Thread Rustom Mody
On Fri, Dec 27, 2013 at 10:50 AM, Andrew Berg wrote: > On 2013.12.26 23:04, Travis McGee wrote: >> The Python.org site says that the future is Python 3, yet whenever I try >> something new in Python, such as Tkinter which I am learning now, >> everything seems to default to Python 2. By this I mea

Re: cascading python executions only if return code is 0

2013-12-26 Thread Roy Smith
In article , Chris Angelico wrote: > On Fri, Dec 27, 2013 at 4:05 PM, Roy Smith wrote: > > There's lists like that for names and genders too. As in, what do you > > mean there are people who don't have exactly two names and one gender? > > And addresses, too. The only way to reliably query th

Re: So, what's the real story on Python 2 vs Python 3?

2013-12-26 Thread Dan Stromberg
On Thu, Dec 26, 2013 at 9:04 PM, Travis McGee wrote: > What's the deal? If I want to make a distributable software package, should > it be 2 or 3? Enquiring minds want to know. 3.x alone isn't a bad option, but it doesn't really have to be an either-or decision. That is, even pretty substantial

Re: So, what's the real story on Python 2 vs Python 3?

2013-12-26 Thread Andrew Berg
On 2013.12.26 23:04, Travis McGee wrote: > The Python.org site says that the future is Python 3, yet whenever I try > something new in Python, such as Tkinter which I am learning now, > everything seems to default to Python 2. By this I mean that, whenever I > find that I need to install another

Re: cascading python executions only if return code is 0

2013-12-26 Thread Chris Angelico
On Fri, Dec 27, 2013 at 4:05 PM, Roy Smith wrote: > There's lists like that for names and genders too. As in, what do you > mean there are people who don't have exactly two names and one gender? And addresses, too. The only way to reliably query the user for an address is with a single field in

Re: How to learn Python effectively

2013-12-26 Thread Dan Stromberg
On Thu, Dec 26, 2013 at 6:54 PM, 汪伟斌 wrote: > I am a beginner in Python, and I find that there are various books about > Python. > There are almost the same contents between some, So I want a recommendation > of a > good order of the books, which can make me learn Python more effectively. > Thanks

Re: So, what's the real story on Python 2 vs Python 3?

2013-12-26 Thread Chris Angelico
On Fri, Dec 27, 2013 at 4:07 PM, Roy Smith wrote: > In article , > Travis McGee wrote: > >> The Python.org site says that the future is Python 3, yet whenever I try >> something new in Python, such as Tkinter which I am learning now, >> everything seems to default to Python 2. By this I mean tha

Re: So, what's the real story on Python 2 vs Python 3?

2013-12-26 Thread Roy Smith
In article , Travis McGee wrote: > The Python.org site says that the future is Python 3, yet whenever I try > something new in Python, such as Tkinter which I am learning now, > everything seems to default to Python 2. By this I mean that, whenever I > find that I need to install another pack

Re: cascading python executions only if return code is 0

2013-12-26 Thread Roy Smith
In article <52bd049d$0$29992$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > Roy Smith wrote: > > > In article , > > Ethan Furman wrote: > > > >> Mostly I don't want newbies thinking "Hey! I can use assertions for all > >> my confidence testing!" > > > > How about this one, t

So, what's the real story on Python 2 vs Python 3?

2013-12-26 Thread Travis McGee
The Python.org site says that the future is Python 3, yet whenever I try something new in Python, such as Tkinter which I am learning now, everything seems to default to Python 2. By this I mean that, whenever I find that I need to install another package, it shows up as Python 2 unless I expli

Re: need to print seconds from the epoch including the millisecond

2013-12-26 Thread Dave Angel
On Thu, 26 Dec 2013 20:03:34 -0500, Terry Reedy wrote: On 12/26/2013 5:48 PM, Dave Angel wrote: > You're probably on Windows, which does time differently. With 3.3 and 3.4 on Windows 7, time.time() gives 6 fractional digits. >>> import time; time.time() 1388105935.971099 With 2.7, same

Re: cascading python executions only if return code is 0

2013-12-26 Thread Chris Angelico
On Fri, Dec 27, 2013 at 3:39 PM, Steven D'Aprano wrote: > Time goes backwards by one hour[1] at least once a year across most of the > world. > > http://infiniteundo.com/post/25509354022/more-falsehoods-programmers-believe-about-time-wisdom > > [1] Unless it's less than an hour. Or more than one h

How to learn Python effectively

2013-12-26 Thread 汪伟斌
I am a beginner in Python, and I find that there are various books about Python. There are almost the same contents between some, So I want a recommendation of a good order of the books, which can make me learn Python more effectively. Thanks a lot.-- https://mail.python.org/mailman/listinfo/

Re: cascading python executions only if return code is 0

2013-12-26 Thread Chris Angelico
On Fri, Dec 27, 2013 at 3:29 PM, Roy Smith wrote: > NTP is never supposed to move the clock backwards. If your system clock > is fast, it's supposed to reduce the rate your clock runs until it's > back in sync. Well, maybe it only does that for small corrections? The exact rules are tweakable,

Re: cascading python executions only if return code is 0

2013-12-26 Thread Steven D'Aprano
Roy Smith wrote: > In article , > Ethan Furman wrote: > >> Mostly I don't want newbies thinking "Hey! I can use assertions for all >> my confidence testing!" > > How about this one, that I wrote yesterday; > > assert second >= self.current_second, "time went backwards" > > I think t

Re: cascading python executions only if return code is 0

2013-12-26 Thread Roy Smith
In article , Chris Angelico wrote: > On Fri, Dec 27, 2013 at 1:20 PM, Dennis Lee Bieber > wrote: > > On Fri, 27 Dec 2013 12:44:35 +1100, Chris Angelico > > declaimed the following: > > > >>On Fri, Dec 27, 2013 at 12:37 PM, Roy Smith wrote: > >>> How about this one, that I wrote yesterday; > >

Re: cascading python executions only if return code is 0

2013-12-26 Thread Tim Chase
On 2013-12-27 12:44, Chris Angelico wrote: > On Fri, Dec 27, 2013 at 12:37 PM, Roy Smith wrote: > > In article , > > Ethan Furman wrote: > > > >> Mostly I don't want newbies thinking "Hey! I can use assertions > >> for all my confidence testing!" > > > > How about this one, that I wrote yes

Re: cascading python executions only if return code is 0

2013-12-26 Thread Chris Angelico
On Fri, Dec 27, 2013 at 1:20 PM, Dennis Lee Bieber wrote: > On Fri, 27 Dec 2013 12:44:35 +1100, Chris Angelico > declaimed the following: > >>On Fri, Dec 27, 2013 at 12:37 PM, Roy Smith wrote: >>> How about this one, that I wrote yesterday; >>> >>> assert second >= self.current_second, "

Re: cascading python executions only if return code is 0

2013-12-26 Thread Chris Angelico
On Fri, Dec 27, 2013 at 12:37 PM, Roy Smith wrote: > In article , > Ethan Furman wrote: > >> Mostly I don't want newbies thinking "Hey! I can use assertions for all my >> confidence testing!" > > How about this one, that I wrote yesterday; > > assert second >= self.current_second, "time

Re: cascading python executions only if return code is 0

2013-12-26 Thread Roy Smith
In article , Ethan Furman wrote: > Mostly I don't want newbies thinking "Hey! I can use assertions for all my > confidence testing!" How about this one, that I wrote yesterday; assert second >= self.current_second, "time went backwards" I think that's pretty high up on the "can neve

Re: need to print seconds from the epoch including the millisecond

2013-12-26 Thread Roy Smith
In article <59aa73ac-e06e-4c0e-83a4-147ac42ca...@googlegroups.com>, matt.doolittl...@gmail.com wrote: > > In [1]: import time > > In [2]: time.time() > > Out[2]: 1388085670.1567955 > > OK i did what you said but I am only getting 2 decimal places. > Why is this and what can I do to get the mil

Re: need to print seconds from the epoch including the millisecond

2013-12-26 Thread Terry Reedy
On 12/26/2013 5:48 PM, Dave Angel wrote: On Thu, 26 Dec 2013 14:06:17 -0800 (PST), matt.doolittl...@gmail.com wrote: On Thursday, December 26, 2013 2:22:10 PM UTC-5, Dan Stromberg wrote: > In [1]: import time > In [2]: time.time() > Out[2]: 1388085670.1567955 OK i did what you said but I am

Re: Recovering deleted files

2013-12-26 Thread Rick Johnson
On Wednesday, December 25, 2013 10:44:39 PM UTC-6, George Tang wrote: > I am new to python and was trying to program with txt > files, and tried to move the txt file to a new directory. > i did not read very carefully about what shutil.move(src, > dst) does and it deleted some of my files. How do i

Re: Getting updates and restarting a long running url request.

2013-12-26 Thread Jason Friedman
> Would this not keep requesting/submitting additional (duplicate) BLAST > queries? >> >> try: >> this_result = get_BLAST(id) >> result_dict[id] = True > I assumed that NCBIWWW.qblast waits for a response from the server. Are you saying that instead it queues a request, a

Re: Google Groups + this list

2013-12-26 Thread rurpy
On 12/25/2013 09:11 PM, Ned Batchelder wrote: > On 12/24/13 8:44 PM, ru...@yahoo.com wrote: >> On 12/23/2013 04:48 AM, Ned Batchelder wrote: >>> On 12/22/13 11:52 PM, ru...@yahoo.com wrote: >[...] >>> But it's a lot of work. >> No, it not a "lot" of work (IMO and I use GG for every >[...] > Yes, th

Re: need to print seconds from the epoch including the millisecond

2013-12-26 Thread Dave Angel
On Thu, 26 Dec 2013 14:06:17 -0800 (PST), matt.doolittl...@gmail.com wrote: On Thursday, December 26, 2013 2:22:10 PM UTC-5, Dan Stromberg wrote: > In [1]: import time > In [2]: time.time() > Out[2]: 1388085670.1567955 OK i did what you said but I am only getting 2 decimal places. You're

Re: cascading python executions only if return code is 0

2013-12-26 Thread Travis Griggs
On Dec 22, 2013, at 10:37 AM, Frank Cui wrote: > hey guys, > > I have a requirement where I need to sequentially execute a bunch of > executions, each execution has a return code. the followed executions should > only be executed if the return code is 0. is there a cleaner or more pythonic >

Re: Recovering deleted files

2013-12-26 Thread Steven D'Aprano
Dennis Lee Bieber wrote: > If I read the documents properly, shutil.move() does not just blindly > delete files (it does a copy/delete if crossing file systems, otherwise it > just does a rename). What difference does that make? Regardless of whether you do a copy/delete or rename, whatever file

Re: need to print seconds from the epoch including the millisecond

2013-12-26 Thread Steven D'Aprano
matt.doolittl...@gmail.com wrote: > On Thursday, December 26, 2013 2:22:10 PM UTC-5, Dan Stromberg wrote: >> On Thu, Dec 26, 2013 at 10:32 AM, wrote: >> >> > i am using 2.7. I need to print the time in seconds from the epoch >> > with millisecond precision. i have tried many things but have

Re: need to print seconds from the epoch including the millisecond

2013-12-26 Thread matt . doolittle33
On Thursday, December 26, 2013 2:22:10 PM UTC-5, Dan Stromberg wrote: > On Thu, Dec 26, 2013 at 10:32 AM, wrote: > > > i am using 2.7. I need to print the time in seconds from the epoch with > > millisecond precision. i have tried many things but have failed. heres my > > latest: > > > >

Re: need to print seconds from the epoch including the millisecond

2013-12-26 Thread Dan Stromberg
On Thu, Dec 26, 2013 at 10:32 AM, wrote: > i am using 2.7. I need to print the time in seconds from the epoch with > millisecond precision. i have tried many things but have failed. heres my > latest: > > from time import time, strftime > from datetime import datetime, time

need to print seconds from the epoch including the millisecond

2013-12-26 Thread matt . doolittle33
i am using 2.7. I need to print the time in seconds from the epoch with millisecond precision. i have tried many things but have failed. heres my latest: from time import time, strftime from datetime import datetime, time # write date, time, then seconds from epoch

Re: Insert NULL into mySQL datetime

2013-12-26 Thread Jussi Piitulainen
Dennis Lee Bieber writes: > On Wed, 25 Dec 2013 17:20:35 -0800 (PST), ru...@yahoo.com declaimed > the following: > > > if a is None: > >cur.execute("Insert Into mytable(datefield) VALUES(NULL))", (,)) > > I'm pretty sure that MySQLdb, at least, does not require the >

Re: Airplane mode control using Python?

2013-12-26 Thread rurpy
On Wednesday, December 25, 2013 3:56:26 AM UTC-7, Chris Angelico wrote: > On Wed, Dec 25, 2013 at 12:37 PM, wrote: > > I have addressed this several times already. All > > software is buggy. I even posted long list on the > > problems I've had with Thunderbird. Choosing any > > software is mak

Re: Getting updates and restarting a long running url request.

2013-12-26 Thread Vincent Davis
On Wed, Dec 25, 2013 at 11:24 PM, Jason Friedman wrote: > Could you keep track of success? > > result_dict = dict() > for id in taxid_list: > result_dict[id] = False > while not all(result_dict.values()): # continue if not every ID was > successful > for id in taxid_list: > if res

Re: Recovering deleted files

2013-12-26 Thread Chris Angelico
On Thu, Dec 26, 2013 at 3:44 PM, George Tang wrote: > I am new to python and was trying to program with txt files, and tried to > move the txt file to a new directory. i did not read very carefully about > what shutil.move(src, dst) does and it deleted some of my files. How do i > recover my lo

Recovering deleted files

2013-12-26 Thread George Tang
I am new to python and was trying to program with txt files, and tried to move the txt file to a new directory. i did not read very carefully about what shutil.move(src, dst) does and it deleted some of my files. How do i recover my lost files. plz help! -- https://mail.python.org/mailman/listi

Re: Apache restart after source changes

2013-12-26 Thread Ned Batchelder
On 12/26/13 12:57 AM, Fredrik Bertilsson wrote: I am evaluating Python for web development and just found out that I need to restart Apache after source changes on windows. Using linux the situation is better but I still have to touch the wsgi file. Is it only me that finds this being a major

Re: Google Groups + this list

2013-12-26 Thread Ned Batchelder
On 12/25/13 11:17 PM, Chris Angelico wrote: On Thu, Dec 26, 2013 at 3:11 PM, Ned Batchelder wrote: Kevin started this thread by asking a question. Chris responded without helping the OP, and talked about Google Groups instead. That's not good. The only reason I didn't directly help the OP w

Re: Apache restart after source changes

2013-12-26 Thread Chris “Kwpolska” Warrick
On Thu, Dec 26, 2013 at 7:36 AM, Fredrik Bertilsson wrote: >> Also, it's not a python issue, it's an issue with your particular >> stack. Other stacks do automatic reloading (for example, the web >> server that Django uses). > > Which web server do you suggest instead of Apache, which doesn't have

Re: Google Groups + this list

2013-12-26 Thread Chris Angelico
On Thu, Dec 26, 2013 at 4:13 PM, wrote: > On 12/25/2013 09:17 PM, Chris Angelico wrote: >>[...] >> Or maybe I should have just filtered everything from Google Groups >> into the bit bucket, because responding just creates threads like >> this. Do you honestly think that would be better? No respon

Re: Google Groups + this list

2013-12-26 Thread rurpy
On 12/25/2013 09:17 PM, Chris Angelico wrote: >[...] > Or maybe I should have just filtered everything from Google Groups > into the bit bucket, because responding just creates threads like > this. Do you honestly think that would be better? No response at all > if the post comes from GG? Do you r

Re: Insert NULL into mySQL datetime

2013-12-26 Thread rurpy
On 12/24/2013 05:33 PM, Igor Korot wrote: > Hi, ALL, > I am working on a script that parses CSV file and after successful > parsing insert data ino mySQL table. > One of the fields in CSV holds a date+time value. > > What the script should do is check if the cell has any data, i.e. not > empty an

Re: Variables in a loop, Newby question

2013-12-26 Thread Chris Angelico
On Thu, Dec 26, 2013 at 7:14 PM, Dave Angel wrote: > On Thu, 26 Dec 2013 16:41:57 +1100, Steven D'Aprano > wrote: >> >> Chris Angelico wrote: >> > Does anyone else have the vague feeling that the OP's problem > might be >> > better served by simply importing the script (thus making those > values

Re: Variables in a loop, Newby question

2013-12-26 Thread Dave Angel
On Thu, 26 Dec 2013 16:41:57 +1100, Steven D'Aprano wrote: Chris Angelico wrote: > Does anyone else have the vague feeling that the OP's problem might be > better served by simply importing the script (thus making those values > available to another Python script) than by any of these rat

Re: Please stop the trolling

2013-12-26 Thread Joshua Landau
On 23 December 2013 20:53, Terry Reedy wrote: > On 12/23/2013 2:05 PM, wxjmfa...@gmail.com wrote: > >> Le lundi 23 décembre 2013 18:59:41 UTC+1, Wolfgang Keller a écrit : >>> >>> [me] I'll note that Python core developers do care about memory leaks. >>> >>> And that's a really good thing