Re: flaming vs accuracy [was Re: Performance of int/long in Python 3]

2013-03-27 Thread Ethan Furman
On 03/27/2013 08:49 PM, rusi wrote: In particular "You are a liar" is as bad as "You are an idiot" The same statement can be made non-abusively thus: "... is not true because ..." I don't agree. With all the posts and micro benchmarks and other drivel that jmf has inflicted on us, I find it /v

Re: flaming vs accuracy [was Re: Performance of int/long in Python 3]

2013-03-27 Thread rusi
On Mar 28, 10:20 am, Steven D'Aprano wrote: > On Wed, 27 Mar 2013 20:49:20 -0700, rusi wrote: > > On Mar 28, 8:18 am, Ethan Furman wrote: > > >> So long as Mark doesn't start cussing and swearing I'm not going to get > >> worked up about it.  I find jmf's posts for more aggravating. > > > I suppo

Re: flaming vs accuracy [was Re: Performance of int/long in Python 3]

2013-03-27 Thread Steven D'Aprano
On Wed, 27 Mar 2013 20:49:20 -0700, rusi wrote: > On Mar 28, 8:18 am, Ethan Furman wrote: >> >> So long as Mark doesn't start cussing and swearing I'm not going to get >> worked up about it.  I find jmf's posts for more aggravating. > > I support Ned's original gentle reminder -- Please be civil

Re: Decorator help

2013-03-27 Thread Steven D'Aprano
On Wed, 27 Mar 2013 22:38:11 -0400, Jason Swails wrote: >> The second case is the easiest. Suppose you have a class like this, >> with many methods which have code in common. Here's a toy example: >> >> >> def MyClass(object): >> x = "class attribute" >> >> def __init__(self, y): >>

Re: Cannot run a single MySQLdb execute....

2013-03-27 Thread Νίκος Γκρ33κ
Τη Πέμπτη, 28 Μαρτίου 2013 6:35:14 π.μ. UTC+2, ο χρήστης Chris Angelico έγραψε: > No. I said to print out the paramstyle attribute. If it's that late > > and you haven't slept, get some sleep, then reread this thread. You > > may be able to respond more intelligently. What is a paramstyle attri

Re: Sudoku

2013-03-27 Thread Dave Angel
On 03/27/2013 11:00 PM, Eric Parry wrote: On Wednesday, March 27, 2013 6:28:01 PM UTC+10:30, Ulrich Eckhardt wrote: http://wiki.python.org/moin/GoogleGroupsPython > Thank you for your explanation. I noticed that in this particular puzzle when it ran out of candidates in a particular cyc

Re: Cannot run a single MySQLdb execute....

2013-03-27 Thread Chris Angelico
On Thu, Mar 28, 2013 at 3:30 PM, Νίκος Γκρ33κ wrote: > Τη Πέμπτη, 28 Μαρτίου 2013 6:26:48 π.μ. UTC+2, ο χρήστης Chris Angelico > έγραψε: >> On Thu, Mar 28, 2013 at 3:18 PM, Νίκος Γκρ33κ wrote: >> >> > Τη Πέμπτη, 28 Μαρτίου 2013 6:08:28 π.μ. UTC+2, ο χρήστης Chris Angelico >> > έγραψε: >> >> > >

Re: Cannot run a single MySQLdb execute....

2013-03-27 Thread Νίκος Γκρ33κ
Τη Πέμπτη, 28 Μαρτίου 2013 6:26:48 π.μ. UTC+2, ο χρήστης Chris Angelico έγραψε: > On Thu, Mar 28, 2013 at 3:18 PM, Νίκος Γκρ33κ wrote: > > > Τη Πέμπτη, 28 Μαρτίου 2013 6:08:28 π.μ. UTC+2, ο χρήστης Chris Angelico > > έγραψε: > > > > > >> As it says in that document, paramstyle is a top-level m

Re: Cannot run a single MySQLdb execute....

2013-03-27 Thread Chris Angelico
On Thu, Mar 28, 2013 at 3:18 PM, Νίκος Γκρ33κ wrote: > Τη Πέμπτη, 28 Μαρτίου 2013 6:08:28 π.μ. UTC+2, ο χρήστης Chris Angelico > έγραψε: > >> As it says in that document, paramstyle is a top-level module >> attribute. Try printing it out. See what it says. Then match your code > > sql = '''SELECT

Re: Cannot run a single MySQLdb execute....

2013-03-27 Thread Νίκος Γκρ33κ
Τη Πέμπτη, 28 Μαρτίου 2013 6:08:28 π.μ. UTC+2, ο χρήστης Chris Angelico έγραψε: > As it says in that document, paramstyle is a top-level module > attribute. Try printing it out. See what it says. Then match your code sql = '''SELECT hits FROM counters WHERE url = %s''' % page print( sql ) cur.ex

Re: Cannot run a single MySQLdb execute....

2013-03-27 Thread Chris Angelico
On Thu, Mar 28, 2013 at 3:08 PM, Νίκος Γκρ33κ wrote: > If you mean if iam using '?' or this '%s' the latter used to work flawlessly > with python 2.6 but it does not in pythin 3.2.3 Print out the value of that attribute. ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: Cannot run a single MySQLdb execute....

2013-03-27 Thread Νίκος Γκρ33κ
If you mean if iam using '?' or this '%s' the latter used to work flawlessly with python 2.6 but it does not in pythin 3.2.3 both this command fail in python 3.x cur.execute( '''SELECT hits FROM counters WHERE url = ?''', (page,) ) cur.execute( '''SELECT hits FROM counters WHERE url = %s''', (

Re: Cannot run a single MySQLdb execute....

2013-03-27 Thread Chris Angelico
On Thu, Mar 28, 2013 at 3:03 PM, Νίκος Γκρ33κ wrote: > Τη Πέμπτη, 28 Μαρτίου 2013 6:00:17 π.μ. UTC+2, ο χρήστης Chris Angelico > έγραψε: > >> What paramstyle are you using? > > Yes it is Chris, but i'am not sure what exactly are you asking me. > Please if you cna pout it even simper for me, thank

Re: Cannot run a single MySQLdb execute....

2013-03-27 Thread Νίκος Γκρ33κ
Τη Πέμπτη, 28 Μαρτίου 2013 6:00:17 π.μ. UTC+2, ο χρήστης Chris Angelico έγραψε: > What paramstyle are you using? Yes it is Chris, but i'am not sure what exactly are you asking me. Please if you cna pout it even simper for me, thank you. -- http://mail.python.org/mailman/listinfo/python-list

Re: Cannot run a single MySQLdb execute....

2013-03-27 Thread Chris Angelico
On Thu, Mar 28, 2013 at 2:50 PM, Νίκος Γκρ33κ wrote: > I'am about to go nuts with python 3.2.3 > > Do you see somehtign wrong with the following statement? > > cur.execute( '''SELECT hits FROM counters WHERE url = ?''', (page,) ) > data = cur.fetchone() > > because as you can see by visiting my we

Re: MySQLdbd error. Perhpas it isn't installed?

2013-03-27 Thread Chris Angelico
On Thu, Mar 28, 2013 at 2:54 PM, Νίκος Γκρ33κ wrote: > this worked > > quote = random.choice( list( open( "/home/nikos/www/data/private/quotes.txt", > 'rb') ) ) > > and also this > > f = open( "/home/nikos/www/" + page, 'rb' ) > > i dont know why python 3 needs 'rb' though. > > Now ima having pro

Cannot run a single MySQLdb execute....

2013-03-27 Thread Νίκος Γκρ33κ
I'am about to go nuts with python 3.2.3 Do you see somehtign wrong with the following statement? cur.execute( '''SELECT hits FROM counters WHERE url = ?''', (page,) ) data = cur.fetchone() because as you can see by visiting my webpage at http://superhost.gr it produces an error and i dont have

Re: MySQLdbd error. Perhpas it isn't installed?

2013-03-27 Thread Νίκος Γκρ33κ
this worked quote = random.choice( list( open( "/home/nikos/www/data/private/quotes.txt", 'rb') ) ) and also this f = open( "/home/nikos/www/" + page, 'rb' ) i dont know why python 3 needs 'rb' though. Now ima having problem with this: htmldata = htmldata % (quote, music) it says soemthign

Re: flaming vs accuracy [was Re: Performance of int/long in Python 3]

2013-03-27 Thread rusi
On Mar 28, 8:18 am, Ethan Furman wrote: > > So long as Mark doesn't start cussing and swearing I'm not going to get > worked up about it.  I > find jmf's posts for more aggravating. I support Ned's original gentle reminder -- Please be civil irrespective of surrounding nonsensical behavior. In

Re: flaming vs accuracy [was Re: Performance of int/long in Python 3]

2013-03-27 Thread Chris Angelico
On Thu, Mar 28, 2013 at 2:18 PM, Ethan Furman wrote: > Has anybody else thought that [jmf's] last few responses are starting to sound > bot'ish? Yes, I did wonder. It's like he and Dihedral have been trading accounts sometimes. Hey, Dihedral, I hear there's a discussion of Unicode and PEP 393 and

flaming vs accuracy [was Re: Performance of int/long in Python 3]

2013-03-27 Thread Ethan Furman
On 03/27/2013 06:47 PM, Steven D'Aprano wrote: On Wed, 27 Mar 2013 11:51:07 +, Mark Lawrence defending an unproductive post flaming a troll: I wouldn't call it unproductive -- a half-dozen amusing posts followed because of Mark's initial post, and they were a great relief from the tedium a

Re: Sudoku

2013-03-27 Thread Eric Parry
On Wednesday, March 27, 2013 6:28:01 PM UTC+10:30, Ulrich Eckhardt wrote: > Am 27.03.2013 06:44, schrieb Eric Parry: > > > I downloaded the following program from somewhere using a link from > > > Wikipedia and inserted the “most difficult Sudoku puzzle ever” string > > > into it and ran it. It

Re: Sudoku

2013-03-27 Thread Eric Parry
Thank you all for your help and suggestions. Eric -- http://mail.python.org/mailman/listinfo/python-list

Re: MySQLdbd error. Perhpas it isn't installed?

2013-03-27 Thread Chris Angelico
On Thu, Mar 28, 2013 at 1:36 PM, Νίκος Γκρ33κ wrote: > Thank you for verifying this, > > Also now http://superhost.gr seems to stuck in the following line which i try > to open an acii file to slect a random line, please take a look. Your quotes file isn't ASCII. Read the error message, Python i

Re: MySQLdbd error. Perhpas it isn't installed?

2013-03-27 Thread Νίκος Γκρ33κ
Τη Πέμπτη, 28 Μαρτίου 2013 4:46:48 π.μ. UTC+2, ο χρήστης Chris Angelico έγραψε: > On Thu, Mar 28, 2013 at 1:36 PM, Νίκος Γκρ33κ wrote: > > > Thank you for verifying this, > > > > > > Also now http://superhost.gr seems to stuck in the following line which i > > try to open an acii file to slect

Re: Decorator help

2013-03-27 Thread Jason Swails
On Wed, Mar 27, 2013 at 7:29 PM, Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote: > > The one doesn't follow from the other. Writing decorators as classes is > fairly unusual. Normally, they will be regular functions. If your > decorator needs to store so much state that it needs to

Re: Altering 2 statements from Python 2.6 => 3.2

2013-03-27 Thread Νίκος Γκρ33κ
Τη Πέμπτη, 28 Μαρτίου 2013 4:28:04 π.μ. UTC+2, ο χρήστης Chris Angelico έγραψε: > On Thu, Mar 28, 2013 at 1:16 PM, Νίκος Γκρ33κ wrote: > > > Τη Πέμπτη, 28 Μαρτίου 2013 12:55:11 π.μ. UTC+2, ο χρήστης Chris Angelico > > έγραψε: > > >> On Thu, Mar 28, 2013 at 7:18 AM, Νίκος Γκρ33κ > >> wrote: >

Re: MySQLdbd error. Perhpas it isn't installed?

2013-03-27 Thread Νίκος Γκρ33κ
Thank you for verifying this, Also now http://superhost.gr seems to stuck in the following line which i try to open an acii file to slect a random line, please take a look. -- http://mail.python.org/mailman/listinfo/python-list

Re: MySQLdbd error. Perhpas it isn't installed?

2013-03-27 Thread Chris Angelico
On Thu, Mar 28, 2013 at 1:24 PM, Νίκος Γκρ33κ wrote: > I think i have figured this out: > > cur.execute( '''SELECT hits FROM counters WHERE url = %s''') , (page,) > > is a tuple of two objects. The first is the result of > cur.execute( '''SELECT hits FROM counters WHERE url = %s''') > and the seco

Re: Altering 2 statements from Python 2.6 => 3.2

2013-03-27 Thread Chris Angelico
On Thu, Mar 28, 2013 at 1:16 PM, Νίκος Γκρ33κ wrote: > Τη Πέμπτη, 28 Μαρτίου 2013 12:55:11 π.μ. UTC+2, ο χρήστης Chris Angelico > έγραψε: >> On Thu, Mar 28, 2013 at 7:18 AM, Νίκος Γκρ33κ wrote: >> >> > date = date.strftime('%A, %e %b %Y').decode('cp1253').encode('utf8') >> >> >> >> For a start,

Re: MySQLdbd error. Perhpas it isn't installed?

2013-03-27 Thread Chris Angelico
On Thu, Mar 28, 2013 at 1:19 PM, Νίκος Γκρ33κ wrote: > The following works in python 3.2 > > [code] > cur.execute( '''SELECT hits FROM counters WHERE url = ?''') , (page,) > [/code] This is an email list and newsgroup. You don't need tags like that. I don't know what you mean by "works".

Re: MySQLdbd error. Perhpas it isn't installed?

2013-03-27 Thread Νίκος Γκρ33κ
I think i have figured this out: cur.execute( '''SELECT hits FROM counters WHERE url = %s''') , (page,) is a tuple of two objects. The first is the result of cur.execute( '''SELECT hits FROM counters WHERE url = %s''') and the second is (page,) cur.execute( '''SELECT hits FROM counters WHERE u

Re: MySQLdbd error. Perhpas it isn't installed?

2013-03-27 Thread Νίκος Γκρ33κ
The following works in python 3.2 [code] cur.execute( '''SELECT hits FROM counters WHERE url = ?''') , (page,) [/code] is there a difefrence between the above and the follwong which works in python 2.6 [code] cur.execute( '''SELECT hits FROM counters WHERE url = ?''' , (pag

Re: MySQLdbd error. Perhpas it isn't installed?

2013-03-27 Thread Νίκος Γκρ33κ
Τη Πέμπτη, 28 Μαρτίου 2013 12:48:54 π.μ. UTC+2, ο χρήστης Dennis Lee Bieber έγραψε: > On Wed, 27 Mar 2013 16:48:44 +, MRAB > > declaimed the following in gmane.comp.python.general: > > > > > > > A brief look at the documentation tells me that MySQL uses '?' as the > > > placeholder ins

Re: Altering 2 statements from Python 2.6 => 3.2

2013-03-27 Thread Νίκος Γκρ33κ
Τη Πέμπτη, 28 Μαρτίου 2013 12:55:11 π.μ. UTC+2, ο χρήστης Chris Angelico έγραψε: > On Thu, Mar 28, 2013 at 7:18 AM, Νίκος Γκρ33κ wrote: > > > date = date.strftime('%A, %e %b %Y').decode('cp1253').encode('utf8') > > > > For a start, figure out what you're trying to do. I'm trying to get my > >

Re: Performance of int/long in Python 3

2013-03-27 Thread Steven D'Aprano
On Wed, 27 Mar 2013 11:51:07 +, Mark Lawrence defending an unproductive post flaming a troll: > He's not going to change so neither am I. "He's a troll disrupting the newsgroup, therefore I'm going to be a troll disrupting the newsgroup too, so nyah!!!" > I also suggest you go and moan at

Re: Separate Rows in reader

2013-03-27 Thread Steven D'Aprano
On Wed, 27 Mar 2013 18:24:24 -0700, rusi wrote: > On Mar 28, 3:26 am, Jiewei Huang wrote: >> On Wednesday, March 27, 2013 9:18:28 PM UTC+10, rusi wrote: >> > On Mar 27, 2:35 pm, Jiewei Huang wrote: >> > > On Tuesday, March 26, 2013 1:48:10 PM UTC+10, MRAB wrote: >> > > > On 26/03/2013 03:33, Jie

Re: Separate Rows in reader

2013-03-27 Thread rusi
On Mar 28, 3:26 am, Jiewei Huang wrote: > On Wednesday, March 27, 2013 9:18:28 PM UTC+10, rusi wrote: > > On Mar 27, 2:35 pm, Jiewei Huang wrote: > > > > On Tuesday, March 26, 2013 1:48:10 PM UTC+10, MRAB wrote: > > > > > On 26/03/2013 03:33, Jiewei Huang wrote: > > > > > > On Tuesday, March 26,

Re: Help me pick an API design (OO vs functional)

2013-03-27 Thread Steven D'Aprano
On Wed, 27 Mar 2013 02:34:09 -0700, Michael Herrmann wrote: > On Tuesday, March 26, 2013 11:37:23 PM UTC+1, Steven D'Aprano wrote: >> >> Global *variables* are bad, not global functions. You have one global >> variable, "the current window". So long as your API makes it obvious >> when the curren

Re: Splitting a list into even size chunks in python?

2013-03-27 Thread Chris Angelico
On Thu, Mar 28, 2013 at 10:42 AM, Roy Smith wrote: > In article , > Chris Angelico wrote: > >> On Wed, Mar 27, 2013 at 11:51 PM, Roy Smith wrote: >> > In article , >> > Peter Otten <__pete...@web.de> wrote: >> > >> >> Look again, for the grouper() recipe. >> > >> > Grouper() is good tty.cooked

Re: Splitting a list into even size chunks in python?

2013-03-27 Thread Roy Smith
In article , Chris Angelico wrote: > On Wed, Mar 27, 2013 at 11:51 PM, Roy Smith wrote: > > In article , > > Peter Otten <__pete...@web.de> wrote: > > > >> Look again, for the grouper() recipe. > > > > Grouper() is good tty.cooked() with just a little time.time() and > > crypt.salt() > > Huh,

Re: Decorator help

2013-03-27 Thread Steven D'Aprano
On Wed, 27 Mar 2013 19:49:54 +, Joseph L. Casale wrote: > I have a class which sets up some class vars, then several methods that > are passed in data and do work referencing the class vars. When you say "class vars", do you mean variables which hold classes? Like "string vars" are variable

Re: Altering 2 statements from Python 2.6 => 3.2

2013-03-27 Thread Chris Angelico
On Thu, Mar 28, 2013 at 7:18 AM, Νίκος Γκρ33κ wrote: > date = date.strftime('%A, %e %b %Y').decode('cp1253').encode('utf8') For a start, figure out what you're trying to do. I'm trying to get my head around this line and I'm not getting anywhere. Is 'date' an instance of datetime.date()? And what

Re: Separate Rows in reader

2013-03-27 Thread Jiewei Huang
On Wednesday, March 27, 2013 9:18:28 PM UTC+10, rusi wrote: > On Mar 27, 2:35 pm, Jiewei Huang wrote: > > > On Tuesday, March 26, 2013 1:48:10 PM UTC+10, MRAB wrote: > > > > On 26/03/2013 03:33, Jiewei Huang wrote: > > > > > > > > On Tuesday, March 26, 2013 11:40:51 AM UTC+10, Dave Angel wrote

Re: Separate Rows in reader

2013-03-27 Thread Jiewei Huang
On Wednesday, March 27, 2013 9:18:28 PM UTC+10, rusi wrote: > On Mar 27, 2:35 pm, Jiewei Huang wrote: > > > On Tuesday, March 26, 2013 1:48:10 PM UTC+10, MRAB wrote: > > > > On 26/03/2013 03:33, Jiewei Huang wrote: > > > > > > > > On Tuesday, March 26, 2013 11:40:51 AM UTC+10, Dave Angel wrote

Re: how do you make a loop run in reverse?

2013-03-27 Thread Arnaud Delobelle
On 26 March 2013 23:59, wrote: > So i have a set of for loops that create this : > > *** > *** *** *** *** *** *** *** > *** *** *** *** *** *** *** >*** *** *** *** *** *** *** >*** *** *** *** *** *** **

RE: Decorator help

2013-03-27 Thread Joseph L. Casale
> So decorators will never take instance variables as arguments (nor should >they, since no instance > can possibly exist when they execute). Right, I never thought of it that way, my only use of them has been trivial, in non class scenarios so far. > Bear in mind, a decorator should take a

Re: Performance of int/long in Python 3

2013-03-27 Thread jmfauth
On 26 mar, 22:08, Grant Edwards wrote: > > I think we all agree that jmf is a character. > -- The characters are also "intrisic characteristics" of a group in the Group Theory. If you are not a mathematician, but eg a scientist in need of these characters, they are available in "precalculat

Re: Decorator help

2013-03-27 Thread Jason Swails
On Wed, Mar 27, 2013 at 3:49 PM, Joseph L. Casale wrote: > I have a class which sets up some class vars, then several methods that > are passed in data > and do work referencing the class vars. > > > I want to decorate these methods, the decorator needs access to the class > vars, so I thought >

Re: Decorator help

2013-03-27 Thread Arnaud Delobelle
On 27 March 2013 19:49, Joseph L. Casale wrote: > I have a class which sets up some class vars, then several methods that are > passed in data > and do work referencing the class vars. > > > I want to decorate these methods, the decorator needs access to the class > vars, so I thought > about ma

Altering 2 statements from Python 2.6 => 3.2

2013-03-27 Thread Νίκος Γκρ33κ
Hello folks, With what do i need to replace: --- print ( "Query Error: ", sys.exc_info()[1].excepinfo()[2] ) - and -- date = date.strftime('%A, %e %b %Y').decode('cp1253').encode('utf8') -- in Python3? because in 2.6 used to work but they dont in Pytho 3 thank yo

Re: Splitting a list into even size chunks in python?

2013-03-27 Thread Arnaud Delobelle
On 27 March 2013 08:27, Peter Otten <__pete...@web.de> wrote: > Look again, for the grouper() recipe. For lists you can also use slicing: > items > ['a', 'b', 'c', 'd', 'e', 'f', 'g'] n = 3 [items[start:start+n] for start in range(0, len(items), n)] > [['a', 'b', 'c'], ['d', 'e', 'f

Decorator help

2013-03-27 Thread Joseph L. Casale
I have a class which sets up some class vars, then several methods that are passed in data and do work referencing the class vars. I want to decorate these methods, the decorator needs access to the class vars, so I thought about making the decorator its own class and allowing it to accept args

Re: MySQLdbd error. Perhpas it isn't installed?

2013-03-27 Thread Νίκος Γκρ33κ
Τη Τετάρτη, 27 Μαρτίου 2013 9:28:35 μ.μ. UTC+2, ο χρήστης Chris Angelico έγραψε: > On Thu, Mar 28, 2013 at 3:48 AM, MRAB wrote: > > A brief look at the documentation tells me that MySQL uses '?' as the > > placeholder instead of '%s': > cur.execute('''SELECT hits FROM counters WHERE url = ?''', (

Re: MySQLdbd error. Perhpas it isn't installed?

2013-03-27 Thread Chris Angelico
On Thu, Mar 28, 2013 at 5:48 AM, Νίκος Γκρ33κ wrote: > I had encoding isseus as well! > > Now i tried your suggestion changing comma with '%' and now the error is more > clear. > > [code] > _mysql_exceptions.OperationalError: (1054, "Unknown column 'index.html' in > 'where clause'") > [/code] N

Re: MySQLdbd error. Perhpas it isn't installed?

2013-03-27 Thread Νίκος Γκρ33κ
Even better: try: sql = '''SELECT hits FROM counters WHERE url = %s''' % page print( sql ) cur.execute( sql ) data = cur.fetchone() except MySQLdb.ProgrammingError as e: print ( "Query Error: ", dir( sys.exc_info()[1] ) ) sql statement seems okey.

Re: MySQLdbd error. Perhpas it isn't installed?

2013-03-27 Thread Νίκος Γκρ33κ
Τη Τετάρτη, 27 Μαρτίου 2013 9:06:27 μ.μ. UTC+2, ο χρήστης Joel Goldstick έγραψε: > You should print the sql statement to see what is being created.  Create the > > > >sql, and assign it to a variable name.  Print that.  Then execute the > command. Ok Joe, i just tried the followinf as you sugge

Re: MySQLdbd error. Perhpas it isn't installed?

2013-03-27 Thread Joel Goldstick
On Wed, Mar 27, 2013 at 2:48 PM, Νίκος Γκρ33κ wrote: > I had encoding isseus as well! > > Now i tried your suggestion changing comma with '%' and now the error is > more clear. > > [code] > _mysql_exceptions.OperationalError: (1054, "Unknown column 'index.html' in > 'where clause'") > [/code] > >

Re: MySQLdbd error. Perhpas it isn't installed?

2013-03-27 Thread Νίκος Γκρ33κ
I had encoding isseus as well! Now i tried your suggestion changing comma with '%' and now the error is more clear. [code] _mysql_exceptions.OperationalError: (1054, "Unknown column 'index.html' in 'where clause'") [/code] loook at http://superhost.gr please to see the whoel traceback -- htt

Re: MySQLdbd error. Perhpas it isn't installed?

2013-03-27 Thread Νίκος Γκρ33κ
=> 187 print ( "Query Error: ", sys.exc_info()[1].excepinfo()[2]) excepinfo is probably mis-spelled---I have no idea what you intend.l Python3 raised exceptions in an except: clause giving the double exception message that I don't think you'd have seen in python2. Maybe the pu

Re: MySQLdbd error. Perhpas it isn't installed?

2013-03-27 Thread nagia . retsina
Τη Τετάρτη, 27 Μαρτίου 2013 6:48:44 μ.μ. UTC+2, ο χρήστης MRAB έγραψε: > On 27/03/2013 06:42, Νίκος Γκρ33κ wrote: > > > Τη Τετάρτη, 27 Μαρτίου 2013 6:26:06 π.μ. UTC+2, ο χρήστης ru...@yahoo.com > > έγραψε: > > > > > >> If not, maybe you can try adding a print statement to your code that > > >>

Re: The usage of -m option of python

2013-03-27 Thread Terry Reedy
On 3/18/2013 11:03 PM, Terry Reedy wrote: On 3/18/2013 5:17 PM, Peng Yu wrote: Hi, I don't quite understand how -m option is used. And it is difficult to search for -m in google. Could anybody provide me with an example on how to use this option? python -m test at a command line runs the regr

Re: The usage of -m option of python

2013-03-27 Thread Tom P
On 03/18/2013 10:17 PM, Peng Yu wrote: Hi, I don't quite understand how -m option is used. And it is difficult to search for -m in google. Could anybody provide me with an example on how to use this option? Thanks! -m module-name Searches sys.path for the named module and

Re: Help me pick an API design (OO vs functional)

2013-03-27 Thread Ethan Furman
On 03/27/2013 02:34 AM, Michael Herrmann wrote: After everybody's input, I think Design #2 or Design #4 would be the best fit for us: Design #2: notepad_1 = start("Notepad") notepad_2 = start("Notepad") switch_to(notepad_1) write("Hello World!") pres

Re: how do you make a loop run in reverse?

2013-03-27 Thread Dave Angel
On 03/26/2013 07:59 PM, rahulredd...@hotmail.com wrote: So i have a set of for loops that create this : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***

Re: MySQLdbd error. Perhpas it isn't installed?

2013-03-27 Thread MRAB
On 27/03/2013 06:42, Νίκος Γκρ33κ wrote: Τη Τετάρτη, 27 Μαρτίου 2013 6:26:06 π.μ. UTC+2, ο χρήστης ru...@yahoo.com έγραψε: If not, maybe you can try adding a print statement to your code that will print the value of 'page'. This will be easier to do if you can run you code interactively. If

Re: Performance of int/long in Python 3

2013-03-27 Thread Dave Angel
On 03/26/2013 07:10 PM, Gregory Ewing wrote: On Wed, Mar 27, 2013 at 8:08 AM, Grant Edwards wrote: Does that allow us to determine wheter integers are idiots or not? No, it doesn't. I'm fairly confident that most of them are not... however, I have my eye on 42. He thought he was equal to 6

Re: Help me pick an API design (OO vs functional)

2013-03-27 Thread Mitya Sirenef
On 03/27/2013 05:10 AM, Michael Herrmann wrote: At the very least, for small dialogs it's sipmpler to do: >> > >> > with press(CTRL + 's'): >> > write("test.txt", into="File name") >> > click("Save") > I think what the context manager approach really has going for itself > is the synt

Re: Splitting a list into even size chunks in python?

2013-03-27 Thread Chris Angelico
On Wed, Mar 27, 2013 at 11:51 PM, Roy Smith wrote: > In article , > Peter Otten <__pete...@web.de> wrote: > >> Look again, for the grouper() recipe. > > Grouper() is good tty.cooked() with just a little time.time() and > crypt.salt() Huh, an inversion of http://xkcd.com/282/ ChrisA -- http://m

Re: From Perl to Python: restructuring a HPC workflow

2013-03-27 Thread Chris Angelico
On Wed, Mar 27, 2013 at 10:29 PM, neurino wrote: > We are a small group of people (approx. 10), working separetely on their own > projects (each employee manages approx. 2-3 projects). We deal with high > loads of data everyday. > > This workflow has been flawless now for at least 15 years. New ge

Re: Splitting a list into even size chunks in python?

2013-03-27 Thread Roy Smith
In article , Peter Otten <__pete...@web.de> wrote: > Look again, for the grouper() recipe. Grouper() is good tty.cooked() with just a little time.time() and crypt.salt() -- http://mail.python.org/mailman/listinfo/python-list

Re: Help me pick an API design (OO vs functional)

2013-03-27 Thread Michael Herrmann
On Wednesday, March 27, 2013 12:44:49 PM UTC+1, Chris Angelico wrote: > ... > Not seeking to advocate this particular option, but it would be > possible to make a single wrapper for all your functions to handle the > focus= parameter: > > def focusable(func): > @functools.wraps(func) >

Re: From Perl to Python: restructuring a HPC workflow

2013-03-27 Thread Joel Goldstick
On Wed, Mar 27, 2013 at 7:51 AM, rusi wrote: > On Mar 27, 4:29 pm, neurino wrote: > > In the need for restructuring our daily workflow, i think it might be a > > good idea to ask the Python community and hopefully initiate a thread > > about pros and cons. > > > > We are a small group of people

Re: From Perl to Python: restructuring a HPC workflow

2013-03-27 Thread rusi
On Mar 27, 4:29 pm, neurino wrote: > In the need for restructuring our daily workflow, i think it might be a > good idea to ask the Python community and hopefully initiate a thread > about pros and cons. > > We are a small group of people (approx. 10), working separetely on > their own projects (e

Re: Performance of int/long in Python 3

2013-03-27 Thread Mark Lawrence
On 27/03/2013 01:31, Ned Deily wrote: In article , Mark Lawrence wrote: On 27/03/2013 00:00, Ned Deily wrote: [...] I repeat the friendly reminder I posted a few weeks ago and I'll be a little less oblique: please avoid gratuitous personal attacks here. It reflects badly on the group and e

Re: Help me pick an API design (OO vs functional)

2013-03-27 Thread Chris Angelico
On Wed, Mar 27, 2013 at 7:55 PM, Michael Herrmann wrote: > On Tuesday, March 26, 2013 5:41:42 PM UTC+1, Dave Angel wrote: >> To go back to my sample wrapper functions, they'd look something like >> (untested): >> >> def write(*args, focus=focused): >> focus.write(*args) > > I understood what

From Perl to Python: restructuring a HPC workflow

2013-03-27 Thread neurino
In the need for restructuring our daily workflow, i think it might be a good idea to ask the Python community and hopefully initiate a thread about pros and cons. We are a small group of people (approx. 10), working separetely on their own projects (each employee manages approx. 2-3 projects).

What web server for WSGI? Recommended book?

2013-03-27 Thread Gilles
Hello After going through multiple articles about the advantage of using WSGI instead of FastCGI + Flup to run Python web apps, I have a couple of questions: 1. Which server + WSGI module would you recommend? I know about Apache and Graham Dumpleton's mod_wsgi, but what about Lighttpd and

Re: Separate Rows in reader

2013-03-27 Thread rusi
On Mar 27, 2:35 pm, Jiewei Huang wrote: > On Tuesday, March 26, 2013 1:48:10 PM UTC+10, MRAB wrote: > > On 26/03/2013 03:33, Jiewei Huang wrote: > > > > On Tuesday, March 26, 2013 11:40:51 AM UTC+10, Dave Angel wrote: > > > >> On 03/25/2013 09:05 PM, Jiewei Huang wrote: > > > >>> On Monday, March

Re: MySQLdbd error. Perhpas it isn't installed?

2013-03-27 Thread Νίκος Γκρ33κ
any help here please? -- http://mail.python.org/mailman/listinfo/python-list

Re: Separate Rows in reader

2013-03-27 Thread Jiewei Huang
On Tuesday, March 26, 2013 1:48:10 PM UTC+10, MRAB wrote: > On 26/03/2013 03:33, Jiewei Huang wrote: > > > On Tuesday, March 26, 2013 11:40:51 AM UTC+10, Dave Angel wrote: > > >> On 03/25/2013 09:05 PM, Jiewei Huang wrote: > > >>> On Monday, March 25, 2013 11:51:51 PM UTC+10, rusi wrote: > > >>

Re: Sudoku

2013-03-27 Thread Dave Angel
On 03/27/2013 01:44 AM, Eric Parry wrote: I downloaded the following program from somewhere It'd be good to show where you found it, and credit the apparent author. Bill Barksdale posted this in 2008 at: http://stackoverflow.com/questions/201461/shortest-sudoku-solver-in-python-how-does-it-

Re: Help me pick an API design (OO vs functional)

2013-03-27 Thread Michael Herrmann
On Tuesday, March 26, 2013 11:37:23 PM UTC+1, Steven D'Aprano wrote: > > Global *variables* are bad, not global functions. You have one global > variable, "the current window". So long as your API makes it obvious when > the current window changes, implicitly operating on the current window is

Re: True/False formats as 1/0 in a fixed width string

2013-03-27 Thread Frank Millman
On 27/03/2013 10:55, Dave Angel wrote: On 03/27/2013 04:40 AM, Frank Millman wrote: Hi all This is a bit of trivia, really, as I don't need a solution. But someone might need it one day, so it is worth mentioning. >>> '{}'.format(True) 'True' >>> '{:<10}'.format(True) '1 ' One migh

Re: Help me pick an API design (OO vs functional)

2013-03-27 Thread Michael Herrmann
On Tuesday, March 26, 2013 11:01:08 PM UTC+1, Mitya Sirenef wrote: > On 03/26/2013 10:59 AM, Michael Herrmann wrote: > > ... > > Forcing the library user to always use the "with ..." seems like > overkill though. I think the gained precision does not justify this > burden on the library user. H

Re: True/False formats as 1/0 in a fixed width string

2013-03-27 Thread Frank Millman
On 27/03/2013 10:52, Peter Otten wrote: Frank Millman wrote: >>> '{}'.format(True) 'True' >>> '{:<10}'.format(True) '1' One might want to format True/False in a fixed width string, but it returns 1/0 instead. Is there any way to make this work? "{!s:<10}".format(True) 'True' Works

Re: Help me pick an API design (OO vs functional)

2013-03-27 Thread Michael Herrmann
On Tuesday, March 26, 2013 5:41:42 PM UTC+1, Dave Angel wrote: > On 03/26/2013 10:40 AM, Michael Herrmann wrote: > > > On Tuesday, March 26, 2013 3:13:30 PM UTC+1, Neil Cerutti wrote: > >> > >> Have you considered adding a keyword argument to each of your > >> global functions, which is normal

Re: True/False formats as 1/0 in a fixed width string

2013-03-27 Thread Dave Angel
On 03/27/2013 04:40 AM, Frank Millman wrote: Hi all This is a bit of trivia, really, as I don't need a solution. But someone might need it one day, so it is worth mentioning. >>> '{}'.format(True) 'True' >>> '{:<10}'.format(True) '1 ' One might want to format True/False in a fixed w

Re: True/False formats as 1/0 in a fixed width string

2013-03-27 Thread Peter Otten
Frank Millman wrote: > >>> '{}'.format(True) > 'True' > >>> '{:<10}'.format(True) > '1 ' > > One might want to format True/False in a fixed width string, but it > returns 1/0 instead. Is there any way to make this work? >>> "{!s:<10}".format(True) 'True ' -- http://mail.python.

Re: Help me pick an API design (OO vs functional)

2013-03-27 Thread Michael Herrmann
On Tuesday, March 26, 2013 4:16:57 PM UTC+1, Chris Angelico wrote: > On Wed, Mar 27, 2013 at 1:59 AM, Michael Herrmann > > wrote: > > save_dialogue = press(CTRL + 's') > > Does every single API need to then consider the possibility of focus > changing? How does the press() function know that thi

Re: Sudoku

2013-03-27 Thread Damien Wyart
* Eric Parry in comp.lang.python: > I downloaded the following program from somewhere using a link from > Wikipedia and inserted the “most difficult Sudoku puzzle ever” string > into it and ran it. It worked fine and solved the puzzle in about > 4 seconds. However I cannot understand how it works.

True/False formats as 1/0 in a fixed width string

2013-03-27 Thread Frank Millman
Hi all This is a bit of trivia, really, as I don't need a solution. But someone might need it one day, so it is worth mentioning. >>> '{}'.format(True) 'True' >>> '{:<10}'.format(True) '1 ' One might want to format True/False in a fixed width string, but it returns 1/0 instead. Is the

Re: Splitting a list into even size chunks in python?

2013-03-27 Thread Peter Otten
Norah Jones wrote: > I have a list of arbitrary length, and I need to split it up into equal > size chunks. There are some obvious ways to do this, like keeping a > counter and two lists, and when the second list fills up, add it to the > first list and empty the second list for the next round of

Re: I need a neat way to print nothing or a number

2013-03-27 Thread Wolfgang Maier
Chris Angelico gmail.com> writes: > > On Wed, Mar 27, 2013 at 4:06 AM, Wolfgang Maier > biologie.uni-freiburg.de> wrote: > > Chris Angelico gmail.com> writes: > > > >> > >> Try printing out this expression: > >> > >> "%.2f"%value if value else '' > >> > >> Without the rest of your code I can't

Re: Sudoku

2013-03-27 Thread Ulrich Eckhardt
Am 27.03.2013 06:44, schrieb Eric Parry: I downloaded the following program from somewhere using a link from Wikipedia and inserted the “most difficult Sudoku puzzle ever” string into it and ran it. It worked fine and solved the puzzle in about 4 seconds. However I cannot understand how it works.

Splitting a list into even size chunks in python?

2013-03-27 Thread Norah Jones
Hi, I have a list of arbitrary length, and I need to split it up into equal size chunks. There are some obvious ways to do this, like keeping a counter and two lists, and when the second list fills up, add it to the first list and empty the second list for the next round of data, but this is p

Re: MySQLdbd error. Perhpas it isn't installed?

2013-03-27 Thread Νίκος Γκρ33κ
And also i must show you that 'page' values are calculated by: # detect how 'index.html' is called and validate variables 'htmlpage' & 'page' if page and os.path.isfile( '/home/nikos/www/cgi-bin/' + page ): page = page elif form.getvalue('show') and os.path.isfile( htmlpage ): page