Re: How clean/elegant is Python's syntax?

2013-05-30 Thread Steven D'Aprano
On Thu, 30 May 2013 02:37:35 +0800, Ma Xiaojun wrote: For pure procedural paradigm, I haven't seen much advantages of Python. Nice syntax with a minimum of boiler plate -- executable pseudo-code, as they say. Extensive library support -- batteries included. These are both good advantages.

Re: Getting a callable for any value?

2013-05-30 Thread Steven D'Aprano
On Wed, 29 May 2013 12:46:19 -0500, Croepha wrote: Is there anything like this in the standard library? class AnyFactory(object): def __init__(self, anything): self.product = anything def __call__(self): return self.product def __repr__(self): return

Re: Short-circuit Logic

2013-05-30 Thread Jussi Piitulainen
Steven D'Aprano writes: On Thu, 30 May 2013 13:45:13 +1000, Chris Angelico wrote: Let's suppose someone is told to compare floating point numbers by seeing if the absolute value of the difference is less than some epsilon. Which is usually the wrong way to do it! Normally one would

Re: Encodign issue in Python 3.3.1 (once again)

2013-05-30 Thread nagia . retsina
Can ypou tell me how to install MySQLdb in python 3 using pip? pip install MySQLdb doesnt find the module. -- http://mail.python.org/mailman/listinfo/python-list

Re: Short-circuit Logic

2013-05-30 Thread Chris Angelico
On Thu, May 30, 2013 at 3:42 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Thu, 30 May 2013 13:45:13 +1000, Chris Angelico wrote: Let's suppose someone is told to compare floating point numbers by seeing if the absolute value of the difference is less than some epsilon.

Re: Short-circuit Logic

2013-05-30 Thread Steven D'Aprano
On Thu, 30 May 2013 10:22:02 +0300, Jussi Piitulainen wrote: I wonder why floating-point errors are not routinely discussed in terms of ulps (units in last position). There is a recipe for calculating the difference of two floating point numbers in ulps, and it's possible to find the previous

Re: How clean/elegant is Python's syntax?

2013-05-30 Thread Ma Xiaojun
On Thu, May 30, 2013 at 2:18 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Which people? People can discuss any rubbish they like. For many reasons, tkinter will not be replaced. For the standard library, it is a good, stable, powerful but not cutting-edge GUI library. If you

Re: Short-circuit Logic

2013-05-30 Thread Jussi Piitulainen
Steven D'Aprano writes: On Thu, 30 May 2013 10:22:02 +0300, Jussi Piitulainen wrote: I wonder why floating-point errors are not routinely discussed in terms of ulps (units in last position). There is a recipe for calculating the difference of two floating point numbers in ulps, and

Re: Encodign issue in Python 3.3.1 (once again)

2013-05-30 Thread Michael Torrie
On 05/29/2013 04:30 AM, nagia.rets...@gmail.com wrote: What makes us o sure it is a pymysql issue and not python's encoding issue? The original traceback, which showed that the encoding error was happening in /opt/python3/lib/python3.3/site-packages/pymysql/cursors.py, line 108. As was said,

Can anyone please help me in understanding the following python code

2013-05-30 Thread bhk755
Code : - def mergeSort(alist): print(Splitting ,alist) if len(alist)1: mid = len(alist)//2 lefthalf = alist[:mid] righthalf = alist[mid:] mergeSort(lefthalf) mergeSort(righthalf) i=0 j=0 k=0 while ilen(lefthalf)

Re: Can anyone please help me in understanding the following python code

2013-05-30 Thread Chris Angelico
On Thu, May 30, 2013 at 7:48 PM, bhk...@gmail.com wrote: Function mergeSort is called only once, but it is getting recursively executed after the printing the last statement print(Merging ,alist). But don't recursion taking place except at these places mergeSort(lefthalf),

Re: Can anyone please help me in understanding the following python code

2013-05-30 Thread Wolfgang Maier
bhk755 at gmail.com writes: Function mergeSort is called only once, but it is getting recursively executed after the printing the last statement print(Merging ,alist). But don't recursion taking place except at these places mergeSort(lefthalf), mergeSort(righthalf) Sometimes the function

Re: Can anyone please help me in understanding the following python code

2013-05-30 Thread bhk755
Thanks for the reply Chris. I am newbie to python, so please excuse me if I am asking chilly questions. Can you please explain more about the following sentence. When it says Splitting with a single-element list, it then immediately prints Merging and returns (because all the rest of the code

Re: Can anyone please help me in understanding the following python code

2013-05-30 Thread Wolfgang Maier
bhk755 at gmail.com writes: Thanks for the reply Chris. I am newbie to python, so please excuse me if I am asking chilly questions. Can you please explain more about the following sentence. When it says Splitting with a single-element list, it then immediately prints Merging and

Re: Can anyone please help me in understanding the following python code

2013-05-30 Thread Chris Angelico
On Thu, May 30, 2013 at 8:19 PM, bhk...@gmail.com wrote: Thanks for the reply Chris. I am newbie to python, so please excuse me if I am asking chilly questions. All questions are welcome! Can you please explain more about the following sentence. When it says Splitting with a single-element

Re: Encodign issue in Python 3.3.1 (once again)

2013-05-30 Thread nagia . retsina
Τη Πέμπτη, 30 Μαΐου 2013 12:29:56 μ.μ. UTC+3, ο χρήστης Michael Torrie έγραψε: On 05/29/2013 04:30 AM, nagia.rets...@gmail.com wrote: What makes us o sure it is a pymysql issue and not python's encoding issue? The original traceback, which showed that the encoding error was

Re: Encodign issue in Python 3.3.1 (once again)

2013-05-30 Thread nagia . retsina
Τη Πέμπτη, 30 Μαΐου 2013 1:53:33 μ.μ. UTC+3, ο χρήστης nagia@gmail.com έγραψε: Τη Πέμπτη, 30 Μαΐου 2013 12:29:56 μ.μ. UTC+3, ο χρήστης Michael Torrie έγραψε: On 05/29/2013 04:30 AM, nagia.rets...@gmail.com wrote: What makes us o sure it is a pymysql issue and not python's

Re: Can anyone please help me in understanding the following python code

2013-05-30 Thread Joshua Landau
On 30 May 2013 10:48, bhk...@gmail.com wrote: Question: - Function mergeSort is called only once, but it is getting recursively executed after the printing the last statement print(Merging ,alist). But don't recursion taking place except at these places mergeSort(lefthalf),

Re: Can anyone please help me in understanding the following python code

2013-05-30 Thread Joshua Landau
On 30 May 2013 11:19, bhk...@gmail.com wrote: Also, Can you please let me know how did you found out that I am using Python 2 Interpreter. Do you have access to a Python3 interpreter? If so, try running it and your output will look like: Splitting [54, 26, 93, 17, 77, 31, 44, 55, 20]

Re: Encodign issue in Python 3.3.1 (once again)

2013-05-30 Thread Chris Angelico
On Thu, May 30, 2013 at 8:53 PM, nagia.rets...@gmail.com wrote: Good morning Michael, I'am afraid as much as you dont want to admin it that the moment i append the charset directive into the connections tring i receive a huge error which it can be displayed in:

User Input

2013-05-30 Thread Eternaltheft
Hi, I'm having trouble oh how prompt the user to enter a file name and how to set up conditions. For example, if there's no file name input by the user, a default is returned -- http://mail.python.org/mailman/listinfo/python-list

Re: User Input

2013-05-30 Thread Fábio Santos
On 30 May 2013 12:42, Eternaltheft eternalth...@gmail.com wrote: Hi, I'm having trouble oh how prompt the user to enter a file name and how to set up conditions. For example, if there's no file name input by the user, a default is returned Are you using raw_input? It returns an empty string if

Re: Encodign issue in Python 3.3.1 (once again)

2013-05-30 Thread Νίκος Γκρ33κ
Τη Πέμπτη, 30 Μαΐου 2013 2:33:56 μ.μ. UTC+3, ο χρήστης Chris Angelico έγραψε: On Thu, May 30, 2013 at 8:53 PM, nagia.rets...@gmail.com wrote: Good morning Michael, I'am afraid as much as you dont want to admin it that the moment i append the charset directive into the connections

Re: User Input

2013-05-30 Thread Eternaltheft
On Thursday, May 30, 2013 7:33:41 PM UTC+8, Eternaltheft wrote: Hi, I'm having trouble oh how prompt the user to enter a file name and how to set up conditions. For example, if there's no file name input by the user, a default is returned Thanks for such a fast reply! and no im not using raw

Re: User Input

2013-05-30 Thread Chris Angelico
On Thu, May 30, 2013 at 9:48 PM, Eternaltheft eternalth...@gmail.com wrote: On Thursday, May 30, 2013 7:33:41 PM UTC+8, Eternaltheft wrote: Hi, I'm having trouble oh how prompt the user to enter a file name and how to set up conditions. For example, if there's no file name input by the user,

Re: User Input

2013-05-30 Thread MRAB
On 30/05/2013 12:48, Eternaltheft wrote: On Thursday, May 30, 2013 7:33:41 PM UTC+8, Eternaltheft wrote: Hi, I'm having trouble oh how prompt the user to enter a file name and how to set up conditions. For example, if there's no file name input by the user, a default is returned Thanks for

Re: User Input

2013-05-30 Thread Fábio Santos
On 30 May 2013 12:58, Eternaltheft eternalth...@gmail.com wrote: On Thursday, May 30, 2013 7:33:41 PM UTC+8, Eternaltheft wrote: Hi, I'm having trouble oh how prompt the user to enter a file name and how to set up conditions. For example, if there's no file name input by the user, a default is

Re: User Input

2013-05-30 Thread Eternaltheft
Ok thanks guys. but when i use filename = input('file name: ') if not filename: #i get filename is not defined return(drawBoard) #possible to return function when no file input from user? -- http://mail.python.org/mailman/listinfo/python-list

Python toplevel in a Web page

2013-05-30 Thread Franck Ditter
Hello, I wonder if I can find some source code example of a Python 3 toplevel box in a Web page. Something simple, no mySQL, no Django hammer, etc. Just the basics of the technology to get the content of a small text editor in which the user writes some Python script, to be analyzed (eval'ed) then

Re: MySQL dymanic query in Python

2013-05-30 Thread RAHUL RAJ
On Wednesday, May 29, 2013 3:32:51 PM UTC+5:30, Fábio Santos wrote: On 29 May 2013 10:13, RAHUL RAJ omrahu...@gmail.com wrote: Can anyone tell me the proper way in which I can execute dynamic MySQL queries in Python? I want to do dynamic queries for both CREATE and INSERT

Is this code correct?

2013-05-30 Thread Νίκος Γκρ33κ
#!/usr/bin/python3 # coding=utf-8 import cgitb; cgitb.enable() import cgi, os, sys from http import cookies # initialize cookie cookie = cookies.SimpleCookie( os.environ.get('HTTP_COOKIE') ) cookie.load( cookie ) nikos = cookie.get('nikos') # if visitor cookie does exist if nikos: msg =

Re: Python teaching book recommendations: 3.3+ and with exercises

2013-05-30 Thread Chris Angelico
On Sat, May 4, 2013 at 12:54 AM, TP wing...@gmail.com wrote: Or maybe Think Python. A *lot* drier presentation than Python for Kids -- after all, the subtitle which I forgot to mention is How to Think Like a Computer Scientist. Newer than Summerfield , but only 1/3 the length . Since I've

Re: User Input

2013-05-30 Thread Fábio Santos
On 30 May 2013 13:24, Eternaltheft eternalth...@gmail.com wrote: Ok thanks guys. but when i use filename = input('file name: ') if not filename: #i get filename is not defined return(drawBoard) #possible to return function when no file input from user? I don't really understand

Re: Is this code correct?

2013-05-30 Thread Chris Angelico
On Thu, May 30, 2013 at 10:25 PM, Νίκος Γκρ33κ supp...@superhost.gr wrote: #!/usr/bin/python3 # coding=utf-8 (chomp a whole lot of code without any indication of what it ought to do) Why not run it and see? If it does what it ought to, it's correct; if it does something different, it's not.

Re: User Input

2013-05-30 Thread Chris Angelico
On Thu, May 30, 2013 at 10:19 PM, Eternaltheft eternalth...@gmail.com wrote: Ok thanks guys. but when i use filename = input('file name: ') if not filename: #i get filename is not defined return(drawBoard) #possible to return function when no file input from user? Do you really

Re: Is this code correct?

2013-05-30 Thread Νίκος Γκρ33κ
This is my last question, everythign else is taken care of. i cant test thjis coe online because i receive this [Thu May 30 15:29:33 2013] [error] [client 46.12.46.11] suexec failure: could not open log file [Thu May 30 15:29:33 2013] [error] [client 46.12.46.11] fopen: Permission denied [Thu

Re: User Input

2013-05-30 Thread Eternaltheft
sorry about that, i got confused xD. yeah it works good now. what i meant to say was can i return a function that i made, if the user inputs nothing? -- http://mail.python.org/mailman/listinfo/python-list

Re: Can anyone please help me in understanding the following python code

2013-05-30 Thread bhk755
Thanks Chris, Wolfgang and Joshua for your replies. --- In step 2b, all the steps from 1 through 3 are executed again (twice). Soon, those calls will just output Splitting followed by Merging; and then we go back to 2c. That's why it *seems* that the code goes from 3 to 2c. You'll notice that

Re: Can anyone please help me in understanding the following python code

2013-05-30 Thread bhk755
On Thursday, May 30, 2013 6:09:20 PM UTC+5:30, bhk...@gmail.com wrote: Thanks Chris, Wolfgang and Joshua for your replies. --- In step 2b, all the steps from 1 through 3 are executed again (twice). Soon, those calls will just output Splitting followed by Merging; and then we go

Re: Short-circuit Logic

2013-05-30 Thread Roy Smith
In article mailman.2395.1369891346.3114.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: On Thu, May 30, 2013 at 3:10 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: # Wrong, don't do this! x = 0.1 while x != 17.3: print(x) x += 0.1

Re: Short-circuit Logic

2013-05-30 Thread Roy Smith
In article qotk3mhx78l@ruuvi.it.helsinki.fi, Jussi Piitulainen jpiit...@ling.helsinki.fi wrote: I wonder why floating-point errors are not routinely discussed in terms of ulps (units in last position). Analysis of error is a complicated topic (and is much older than digital computers).

Re: Can anyone please help me in understanding the following python code

2013-05-30 Thread bhk755
On Thursday, May 30, 2013 6:09:20 PM UTC+5:30, bhk...@gmail.com wrote: Thanks Chris, Wolfgang and Joshua for your replies. --- In step 2b, all the steps from 1 through 3 are executed again (twice). Soon, those calls will just output Splitting followed by Merging; and then we go

Re: Is this code correct?

2013-05-30 Thread Νίκος Γκρ33κ
Τη Πέμπτη, 30 Μαΐου 2013 3:34:09 μ.μ. UTC+3, ο χρήστης Chris Angelico έγραψε: On Thu, May 30, 2013 at 10:25 PM, Νίκος Γκρ33κ supp...@superhost.gr wrote: #!/usr/bin/python3 # coding=utf-8 (chomp a whole lot of code without any indication of what it ought to do) Why not run it

Re: Can anyone please help me in understanding the following python code

2013-05-30 Thread Chris Angelico
On Thu, May 30, 2013 at 10:39 PM, bhk...@gmail.com wrote: Chris, Can you please let me know what makes the control of the program code go to 2c after the output Merging. It goes like this: 1. [eight element list] 2a. [eight element list] 2b. 1. [four element list] 2b. 2a. [four element

Re: Short-circuit Logic

2013-05-30 Thread Chris Angelico
On Thu, May 30, 2013 at 10:40 PM, Roy Smith r...@panix.com wrote: if somebody were to accidentally drop three zeros into the source code: x = 1000 while x 173: print(x) x += 1 should the loop just quietly not execute (which is what it will do here)? Will that make your program

Re: User Input

2013-05-30 Thread Dave Angel
On 05/30/2013 08:37 AM, Eternaltheft wrote: sorry about that, i got confused xD. yeah it works good now. what i meant to say was can i return a function that i made, if the user inputs nothing? There wouldn't be anything to stop you. However, if you have multiple returns from the same

Re: Can anyone please help me in understanding the following python code

2013-05-30 Thread bhk755
Thanks Chris, Wolfgang and Joshua for your replies. In step 2b, all the steps from 1 through 3 are executed again (twice). Soon, those calls will just output Splitting followed by Merging; and then we go back to 2c. That's why it *seems* that the code goes from 3

Re: Is this code correct?

2013-05-30 Thread Chris Angelico
On Thu, May 30, 2013 at 10:31 PM, Νίκος Γκρ33κ supp...@superhost.gr wrote: This is my last question, everythign else is taken care of. i cant test thjis coe online because i receive this [Thu May 30 15:29:33 2013] [error] [client 46.12.46.11] suexec failure: could not open log file [Thu

Re: User Input

2013-05-30 Thread Eternaltheft
yeah i found out why it wasn't defined before because i tried to put it into a function. this is my drawBoard function: import turtle as Turtle Turtle.title(Checkers) b = 75 def drawBoard(b): Turtle.speed(0) Turtle.up() Turtle.goto(-4 * b, 4 * b) Turtle.down() for i

Re: User Input

2013-05-30 Thread Chris Angelico
On Thu, May 30, 2013 at 10:37 PM, Eternaltheft eternalth...@gmail.com wrote: sorry about that, i got confused xD. yeah it works good now. what i meant to say was can i return a function that i made, if the user inputs nothing? Sure! Anything you want to do, you can do :) ChrisA --

Re: Is this code correct?

2013-05-30 Thread Νίκος Γκρ33κ
Τη Πέμπτη, 30 Μαΐου 2013 3:59:21 μ.μ. UTC+3, ο χρήστης Chris Angelico έγραψε: On Thu, May 30, 2013 at 10:31 PM, Νίκος Γκρ33κ supp...@superhost.gr wrote: This is my last question, everythign else is taken care of. i cant test thjis coe online because i receive this [Thu May 30

Re: Is this code correct?

2013-05-30 Thread Mark Lawrence
On 30/05/2013 13:31, Νίκος Γκρ33κ wrote: This is my last question, everythign else is taken care of. i cant test thjis coe online because i receive this [Thu May 30 15:29:33 2013] [error] [client 46.12.46.11] suexec failure: could not open log file [Thu May 30 15:29:33 2013] [error] [client

Re: Can anyone please help me in understanding the following python code

2013-05-30 Thread Dave Angel
On 05/30/2013 08:42 AM, bhk...@gmail.com wrote: SNIP lots of double-spaced googlegroups nonsense. Please read this http://wiki.python.org/moin/GoogleGroupsPython In the above output, the control goes to HERE AFTER SPLIT after the Merging statement which is of-course the

Re: Is this code correct?

2013-05-30 Thread Νίκος Γκρ33κ
Τη Πέμπτη, 30 Μαΐου 2013 4:05:00 μ.μ. UTC+3, ο χρήστης Mark Lawrence έγραψε: Please ask questions unrelated to Python on a list that is unrelated to Python. Okey, i will. -- http://mail.python.org/mailman/listinfo/python-list

Re: Is this code correct?

2013-05-30 Thread Chris Angelico
On Thu, May 30, 2013 at 11:05 PM, Mark Lawrence breamore...@yahoo.co.uk wrote: Please ask questions unrelated to Python on a list that is unrelated to Python. Lemme guess, he's next going to ask on the PostgreSQL mailing list. I mean, that's unrelated to Python, right? ChrisA --

Re: User Input

2013-05-30 Thread Dave Angel
On 05/30/2013 09:10 AM, Eternaltheft wrote: yeah i found out why it wasn't defined before because i tried to put it into a function. That's not a sentence, and it doesn't make sense in any permutation I can do on it. this is my drawBoard function: import turtle as Turtle

Re: Is this code correct?

2013-05-30 Thread Νίκος Γκρ33κ
Τη Πέμπτη, 30 Μαΐου 2013 4:36:11 μ.μ. UTC+3, ο χρήστης Chris Angelico έγραψε: Lemme guess, he's next going to ask on the PostgreSQL mailing list. I mean, that's unrelated to Python, right? Well Chris, i'am not that stupid :) I intend to ask questions unrelated to Python to a list unrelated to

Re: User Input

2013-05-30 Thread Eternaltheft
do you think ti would be better if i call drawBoard? -- http://mail.python.org/mailman/listinfo/python-list

Re: User Input

2013-05-30 Thread Mark Lawrence
On 30/05/2013 15:03, Eternaltheft wrote: do you think ti would be better if i call drawBoard? How would I know if you don't quote any context? -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence --

Re: Encodign issue in Python 3.3.1 (once again)

2013-05-30 Thread Michael Torrie
On 05/30/2013 05:47 AM, Νίκος Γκρ33κ wrote: The moen i switched charset = 'utf-8' = charset = 'utf8' all started to work properly! Glad you have it working. Perhaps this should be a lesson to you, Nick. Chris was able to spot your problem by READING THE DOCUMENTATION, which he probably found

Re: Encodign issue in Python 3.3.1 (once again)

2013-05-30 Thread Chris Angelico
On Fri, May 31, 2013 at 12:35 AM, Michael Torrie torr...@gmail.com wrote: On 05/30/2013 05:47 AM, Νίκος Γκρ33κ wrote: The moen i switched charset = 'utf-8' = charset = 'utf8' all started to work properly! Glad you have it working. Perhaps this should be a lesson to you, Nick. Chris was

Re: User Input

2013-05-30 Thread Eternaltheft
And perhaps you meant for your function to CALL drawBoard(), rather than returning the function object drawBoard. DaveA do you think it would be better if i call drawBoard? -- http://mail.python.org/mailman/listinfo/python-list

Re: User Input

2013-05-30 Thread Eternaltheft
And perhaps you meant for your function to CALL drawBoard(), rather than returning the function object drawBoard. DaveA do you think it would be better if i call drawBoard? -- http://mail.python.org/mailman/listinfo/python-list

Re: User Input

2013-05-30 Thread Joshua Landau
On 30 May 2013 15:47, Eternaltheft eternalth...@gmail.com wrote: And perhaps you meant for your function to CALL drawBoard(), rather than returning the function object drawBoard. DaveA do you think it would be better if i call drawBoard? Please read

Re: [ANN] pyknon: Simple Python library to generate music in a hacker friendly way.

2013-05-30 Thread sanjaybwaj
Thanks a lot, Sir. Just what I was looking for. This is a fantastic library for python. -- http://mail.python.org/mailman/listinfo/python-list

Re: The state of pySerial

2013-05-30 Thread MRAB
On 30/05/2013 02:32, Ma Xiaojun wrote: I've already mailed the author, waiting for reply. For Windows people, downloading a exe get you pySerial 2.5, which list_ports and miniterm feature seems not included. To use 2.6, download the tar.gz and use standard setup.py install to install it (assume

Re: Short-circuit Logic

2013-05-30 Thread Ethan Furman
On 05/30/2013 05:58 AM, Chris Angelico wrote: On Thu, May 30, 2013 at 10:40 PM, Roy Smith r...@panix.com wrote: if somebody were to accidentally drop three zeros into the source code: x = 1000 while x 173: print(x) x += 1 should the loop just quietly not execute (which is what it

Re: Short-circuit Logic

2013-05-30 Thread Chris Angelico
On Fri, May 31, 2013 at 1:02 AM, Ethan Furman et...@stoneleaf.us wrote: On 05/30/2013 05:58 AM, Chris Angelico wrote: If you iterate from 1000 to 173, you get nowhere. This is the expected behaviour; this is what a C-style for loop would be written as, it's what range() does, it's the normal

Re: Short-circuit Logic

2013-05-30 Thread Steven D'Aprano
On Fri, 31 May 2013 01:56:09 +1000, Chris Angelico wrote: On Fri, May 31, 2013 at 1:02 AM, Ethan Furman et...@stoneleaf.us wrote: On 05/30/2013 05:58 AM, Chris Angelico wrote: If you iterate from 1000 to 173, you get nowhere. This is the expected behaviour; this is what a C-style for loop

Re: Future standard GUI library

2013-05-30 Thread Wolfgang Keller
suppose I now want the app natively on my phone (because that's all the rage). It's an iPhone. Oh. Apple doesn't support Python. Okay, rewrite the works, including business logic, in Objective C. Now I want it on my android phone. Those are gadgets, not work tools. As a

Google App Engine dev_appserver and pdb?

2013-05-30 Thread Tom P
Is there a way to use pdb to debug Google apps written in Python? When I start the development system to run the app test like this - './google_appengine/dev_appserver.py' './test' - I'd like to send the program into debug. I couldn't see anything in the documentation how to do this. If I do

Re: Future standard GUI library

2013-05-30 Thread Chris Angelico
On Fri, May 31, 2013 at 2:40 AM, Wolfgang Keller felip...@gmx.net wrote: A GUI that can not be used without taking the ten fingers off the keyboard is indeed entirely unusable for any half-proficient screenworker. And anyone doing actual productive screenwork every day for more than just a few

Re: Short-circuit Logic

2013-05-30 Thread rusi
On May 30, 5:58 pm, Chris Angelico ros...@gmail.com wrote: The alternative would be an infinite number of iterations, which is far far worse. There was one heavyweight among programming teachers -- E.W. Dijkstra -- who had some rather extreme views on this. He taught that when writing a loop

Re: Short-circuit Logic

2013-05-30 Thread Ethan Furman
On 05/30/2013 08:56 AM, Chris Angelico wrote: On Fri, May 31, 2013 at 1:02 AM, Ethan Furman et...@stoneleaf.us wrote: On 05/30/2013 05:58 AM, Chris Angelico wrote: If you iterate from 1000 to 173, you get nowhere. This is the expected behaviour; this is what a C-style for loop would be written

Re: Encodign issue in Python 3.3.1 (once again)

2013-05-30 Thread Michael Torrie
On 05/30/2013 08:40 AM, Chris Angelico wrote: but if he's actively using the module, he probably knows where to find its docs. One would hope, but alas one probably hopes in vain. I'm not sure he wants to spend the time to read the code he's using and understand. He's in too much of a hurry to

Re: How clean/elegant is Python's syntax?

2013-05-30 Thread rusi
On Thu, May 30, 2013 at 9:34 AM, Ma Xiaojun damage3...@gmail.com wrote: On Thu, May 30, 2013 at 10:49 AM, rusi rustompm...@gmail.com wrote: Ha,Ha! The join method is one of the (for me) ugly features of python. You can sweep it under the carpet with a one-line join function and then write

THRINAXODON BURTS AN AXON!

2013-05-30 Thread Thrinaxodon
THRINAXODON HAS JUST ENTERED THE WORLD OF REASON-RALLY. SUCH WILD BEASTS AS PETER NYIKOS, PZ MYERS, RICHARD DAWKINS, DR. EVIL, JOHN S. WILKINS, JERRY COYNE, MARK ISAAK, SKYEYES, BUDIKKA666, FIDEL TUBARE, SBAELNAVE, BOB CASANOVA, JOHN HARSHMAN, DAVID IAIN GREIG, AND JILLERY WERE THERE. THEY WERE

Re: Short-circuit Logic

2013-05-30 Thread Chris Angelico
On Fri, May 31, 2013 at 2:58 AM, rusi rustompm...@gmail.com wrote: On May 30, 5:58 pm, Chris Angelico ros...@gmail.com wrote: The alternative would be an infinite number of iterations, which is far far worse. There was one heavyweight among programming teachers -- E.W. Dijkstra -- who had

Re: How clean/elegant is Python's syntax?

2013-05-30 Thread Chris Angelico
On Fri, May 31, 2013 at 3:12 AM, rusi rustompm...@gmail.com wrote: You associate the primal (f)act of thinking about programming with *doing* the generating. By contrast the functional programmer thinks about what *is* the result. I wish you'd explain that to my boss :) He often has trouble

Re: Encodign issue in Python 3.3.1 (once again)

2013-05-30 Thread Chris Angelico
On Fri, May 31, 2013 at 3:01 AM, Michael Torrie torr...@gmail.com wrote: On 05/30/2013 08:40 AM, Chris Angelico wrote: but if he's actively using the module, he probably knows where to find its docs. One would hope, but alas one probably hopes in vain. I'm not sure he wants to spend the

Re: How clean/elegant is Python's syntax?

2013-05-30 Thread Ma Xiaojun
On Fri, May 31, 2013 at 1:28 AM, Chris Angelico ros...@gmail.com wrote: for (int i=0;infoo;++i) if (foo[i].marker) { //do something with foo[i] } This is interesting! -- http://mail.python.org/mailman/listinfo/python-list

Re: How clean/elegant is Python's syntax?

2013-05-30 Thread Chris Angelico
On Fri, May 31, 2013 at 3:46 AM, Ma Xiaojun damage3...@gmail.com wrote: On Fri, May 31, 2013 at 1:28 AM, Chris Angelico ros...@gmail.com wrote: for (int i=0;infoo;++i) if (foo[i].marker) { //do something with foo[i] } This is interesting! Yeah, but that's C++. It won't work in Python

usage of os.posix_fadvise

2013-05-30 Thread Wolfgang Maier
Antoine Pitrou wrote: Hi, Wolfgang Maier wolfgang.maier at biologie.uni-freiburg.de writes: Dear all, I was just experimenting for the first time with os.posix_fadvise(), which is new in Python3.3 . I'm reading from a really huge file (several GB) and I want to use the data only once, so I

Re: How clean/elegant is Python's syntax?

2013-05-30 Thread rusi
On May 30, 10:28 pm, Chris Angelico ros...@gmail.com wrote: On Fri, May 31, 2013 at 3:12 AM, rusi rustompm...@gmail.com wrote: You associate the primal (f)act of thinking about programming with *doing* the generating. By contrast the functional programmer thinks about what *is* the

Re: How clean/elegant is Python's syntax?

2013-05-30 Thread Ma Xiaojun
functional VS imperative? mechanical thinking VS mathematical thinking? Sounds interesting. -- http://mail.python.org/mailman/listinfo/python-list

Python and GIL

2013-05-30 Thread Ana Marija Sokovic
Hi, Can somebody explain to me how would you proceed in releasing the GIL and whether you think it will have consequences? Thanks Ana -- http://mail.python.org/mailman/listinfo/python-list

Re: How clean/elegant is Python's syntax?

2013-05-30 Thread Chris Angelico
On Fri, May 31, 2013 at 3:59 AM, rusi rustompm...@gmail.com wrote: On May 30, 10:28 pm, Chris Angelico ros...@gmail.com wrote: On Fri, May 31, 2013 at 3:12 AM, rusi rustompm...@gmail.com wrote: You associate the primal (f)act of thinking about programming with *doing* the generating. By

Re: How to get an integer from a sequence of bytes

2013-05-30 Thread Mok-Kong Shen
Am 27.05.2013 17:30, schrieb Ned Batchelder: On 5/27/2013 10:45 AM, Mok-Kong Shen wrote: From an int one can use to_bytes to get its individual bytes, but how can one reconstruct the int from the sequence of bytes? The next thing in the docs after int.to_bytes is int.from_bytes:

Re: Python and GIL

2013-05-30 Thread Chris Angelico
On Fri, May 31, 2013 at 4:14 AM, Ana Marija Sokovic sokovic.anamar...@gmail.com wrote: Hi, Can somebody explain to me how would you proceed in releasing the GIL and whether you think it will have consequences? You release the GIL in C-level code when you don't need to work with Python objects

Re: How clean/elegant is Python's syntax?

2013-05-30 Thread Ian Kelly
On Wed, May 29, 2013 at 8:49 PM, rusi rustompm...@gmail.com wrote: On May 30, 6:14 am, Ma Xiaojun damage3...@gmail.com wrote: What interest me is a one liner: print '\n'.join(['\t'.join(['%d*%d=%d' % (j,i,i*j) for i in range(1,10)]) for j in range(1,10)]) Ha,Ha! The join method is one of the

Re: How to get an integer from a sequence of bytes

2013-05-30 Thread Ian Kelly
On Thu, May 30, 2013 at 12:26 PM, Mok-Kong Shen mok-kong.s...@t-online.de wrote: Am 27.05.2013 17:30, schrieb Ned Batchelder: On 5/27/2013 10:45 AM, Mok-Kong Shen wrote: From an int one can use to_bytes to get its individual bytes, but how can one reconstruct the int from the sequence of

Re: How clean/elegant is Python's syntax?

2013-05-30 Thread Chris Angelico
On Fri, May 31, 2013 at 4:36 AM, Ian Kelly ian.g.ke...@gmail.com wrote: On Wed, May 29, 2013 at 8:49 PM, rusi rustompm...@gmail.com wrote: On May 30, 6:14 am, Ma Xiaojun damage3...@gmail.com wrote: What interest me is a one liner: print '\n'.join(['\t'.join(['%d*%d=%d' % (j,i,i*j) for i in

Re: How clean/elegant is Python's syntax?

2013-05-30 Thread rusi
On May 30, 11:36 pm, Ian Kelly ian.g.ke...@gmail.com wrote: On Wed, May 29, 2013 at 8:49 PM, rusi rustompm...@gmail.com wrote: On May 30, 6:14 am, Ma Xiaojun damage3...@gmail.com wrote: What interest me is a one liner: print '\n'.join(['\t'.join(['%d*%d=%d' % (j,i,i*j) for i in

Re: How clean/elegant is Python's syntax?

2013-05-30 Thread Ian Kelly
On Thu, May 30, 2013 at 12:44 PM, Chris Angelico ros...@gmail.com wrote: On Fri, May 31, 2013 at 4:36 AM, Ian Kelly ian.g.ke...@gmail.com wrote: I don't object to changing the join method (one of the more shoe-horned string methods) back into a function, but to my eyes you've got the arguments

Re: How to get an integer from a sequence of bytes

2013-05-30 Thread jmfauth
On 30 mai, 20:42, Ian Kelly ian.g.ke...@gmail.com wrote: On Thu, May 30, 2013 at 12:26 PM, Mok-Kong Shen mok-kong.s...@t-online.de wrote: Am 27.05.2013 17:30, schrieb Ned Batchelder: On 5/27/2013 10:45 AM, Mok-Kong Shen wrote: From an int one can use to_bytes to get its individual

OpenMP uses only 1 core as soon as numpy is loaded

2013-05-30 Thread Wout Megchelenbrink
I use openMp in a C-extension that has an interface with Python. In its simplest form I do this: == code == #pragma omp parallel { #pragma omp for for(int i=0; i10; i++) { // multiply some matrices in C

Re: How to get an integer from a sequence of bytes

2013-05-30 Thread Ned Batchelder
On 5/30/2013 2:26 PM, Mok-Kong Shen wrote: Am 27.05.2013 17:30, schrieb Ned Batchelder: On 5/27/2013 10:45 AM, Mok-Kong Shen wrote: From an int one can use to_bytes to get its individual bytes, but how can one reconstruct the int from the sequence of bytes? The next thing in the docs after

Re: Short-circuit Logic

2013-05-30 Thread Steven D'Aprano
On Thu, 30 May 2013 16:40:52 +, Steven D'Aprano wrote: On Fri, 31 May 2013 01:56:09 +1000, Chris Angelico wrote: You're assuming you can casually hit Ctrl-C to stop an infinite loop, meaning that it's trivial. It's not. Not everything lets you do that; or possibly halting the process

Re: Short-circuit Logic

2013-05-30 Thread Neil Cerutti
On 2013-05-30, Chris Angelico ros...@gmail.com wrote: On Thu, May 30, 2013 at 3:10 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: # Wrong, don't do this! x = 0.1 while x != 17.3: print(x) x += 0.1 Actually, I wouldn't do that with integers either. I propose

Re: How clean/elegant is Python's syntax?

2013-05-30 Thread MRAB
On 30/05/2013 19:44, Chris Angelico wrote: On Fri, May 31, 2013 at 4:36 AM, Ian Kelly ian.g.ke...@gmail.com wrote: On Wed, May 29, 2013 at 8:49 PM, rusi rustompm...@gmail.com wrote: On May 30, 6:14 am, Ma Xiaojun damage3...@gmail.com wrote: What interest me is a one liner: print

  1   2   3   >