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

2013-03-26 Thread Νίκος Γκρ33κ
Τη Τετάρτη, 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 you have to run it via a webserver >

Re: honking great ideas

2013-03-26 Thread Sean Felipe Wolfe
On Tue, Mar 26, 2013 at 7:25 PM, Ned Deily wrote: > One suggestion: take a look at Raymond Hettinger's keynote address from > the recent PyCon. Any of Raymond's talks are worth viewing but this one > in particular is a higher-level sales pitch for Python: "Show the > specific features that make

Sudoku

2013-03-26 Thread 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. It seems to go backwards and forwards a

Re: Performance of int/long in Python 3

2013-03-26 Thread rurpy
On Tuesday, March 26, 2013 6:00:43 PM UTC-6, Ned Deily wrote: > In article , > Mark Lawrence wrote: > > But you are an idiot. > > 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

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

2013-03-26 Thread rurpy
On 03/26/2013 03:24 PM, Νίκος Γκρ33κ wrote:> Hello today i deiced to go form python 2.6 to python 3.2.3 > > although in 2.6 my script runs in the ht enewest python i ge this error: > > > Traceback (most recent call last): > File > "/opt/python3/lib/python3.2/site-packages/MySQL_python-1.2.3-

Re: honking great ideas

2013-03-26 Thread Ned Deily
In article , Sean Felipe Wolfe wrote: > So I have been re-reading some of the python intro stuffs after a time > away philandering with other languages. I have been thinking about the > Zen of Python piece where it says 'namespaces are a honking great idea > - let's do more of those'. > > A que

Re: Performance of int/long in Python 3

2013-03-26 Thread Ned Deily
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 especially on those people maki

honking great ideas

2013-03-26 Thread Sean Felipe Wolfe
So I have been re-reading some of the python intro stuffs after a time away philandering with other languages. I have been thinking about the Zen of Python piece where it says 'namespaces are a honking great idea - let's do more of those'. A question -- since then do we have any sort of list of ma

Re: How to define "exec" method on a class object? Get syntax error due to built in command

2013-03-26 Thread Chris Angelico
On Wed, Mar 27, 2013 at 10:19 AM, Steven D'Aprano wrote: > On Wed, 27 Mar 2013 06:39:24 +1100, Chris Angelico wrote: >> I strongly recommend upgrading. 2.3.4 dates back to 2004, that's roughly >> a decade of bug fixes and feature enhancements behind the times. > > Python 2.3 is still supported by

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

2013-03-26 Thread Oscar Benjamin
> On 27 March 2013 10:59, wrote: >> >> So i have a set of for loops that create this : >> [snip] >> but i want to nest all the loops under one BIG loop that'll run in reverse >> to make this: [snip] >> Is this possible? On 27 March 2013 00:19, Xavier Ho wrote: > There is a built-in function that

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

2013-03-26 Thread MRAB
On 26/03/2013 21:24, Νίκος Γκρ33κ wrote: Hello today i deiced to go form python 2.6 to python 3.2.3 although in 2.6 my script runs in the ht enewest python i ge this error: Traceback (most recent call last): File "/opt/python3/lib/python3.2/site-packages/MySQL_python-1.2.3-py3.2-linux-x86_

Re: import in Python3.3

2013-03-26 Thread rocky
On Tuesday, March 26, 2013 7:06:02 PM UTC-4, Steven D'Aprano wrote: > On Tue, 26 Mar 2013 08:37:00 -0700, rocky wrote: > > > > > So again I come to import_relative, > > > http://code.google.com/p/pyimport-relative/. And again, I wish this > > > package didn't have to exist. > > > > > > I

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

2013-03-26 Thread Xavier Ho
There is a built-in function that reverses an iterable. Have a look at the documentation. xav On 27 March 2013 10:59, wrote: > So i have a set of for loops that create this : > > *** > *** *** *** *** *** *** *** > *** *** *** *** ***

Re: Performance of int/long in Python 3

2013-03-26 Thread Mark Lawrence
On 27/03/2013 00:00, Ned Deily wrote: In article , Mark Lawrence wrote: But you are an idiot. 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 especially on those peo

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

2013-03-26 Thread Mark Lawrence
On 26/03/2013 23:59, rahulredd...@hotmail.com wrote: So i have a set of for loops that create this : snipped the art but i want to nest all the loops under one BIG loop that'll run in reverse to make this: snipped the art Is this possible? Yes read http://docs.python.org/3/library

Re: Performance of int/long in Python 3

2013-03-26 Thread Ned Deily
In article , Mark Lawrence wrote: > But you are an idiot. 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 especially on those people making them. We can disagree stro

how do you make a loop run in reverse?

2013-03-26 Thread rahulreddy24
So i have a set of for loops that create this : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** **

Re: How to define "exec" method on a class object? Get syntax error due to built in command

2013-03-26 Thread Steven D'Aprano
On Wed, 27 Mar 2013 06:39:24 +1100, Chris Angelico wrote: > On Wed, Mar 27, 2013 at 6:24 AM, Kyle wrote: >> On Mar 26, 2:43 pm, Chris Angelico wrote: >>> On Wed, Mar 27, 2013 at 5:13 AM, Kyle wrote: >>> > Thanks for the suggestion. Looks like we currently use 2.3.4. >>> >>> > This still wouldn'

Re: Performance of int/long in Python 3

2013-03-26 Thread Gregory Ewing
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 x 9 at one point, which seems pretty idiotic

Re: import in Python3.3

2013-03-26 Thread Steven D'Aprano
On Tue, 26 Mar 2013 12:33:54 -0400, Jerry Hill wrote: > On Mon, Mar 25, 2013 at 11:49 PM, rocky wrote: >>> On Sun, 24 Mar 2013 18:12:49 -0500, Fabian von Romberg wrote: >>> > I have a package name collections and inside of my package I want to > >> I find this kind of thing sad: it feels to me t

Re: import in Python3.3

2013-03-26 Thread Steven D'Aprano
On Tue, 26 Mar 2013 08:37:00 -0700, rocky wrote: > And again, I get the impression that for the use case asked about, there > isn't much ambiguity. If I am in mypackage.foo and I want to access > mypackage.collections I should be able to say something like that > without ambiguity or that much inf

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

2013-03-26 Thread Steven D'Aprano
On Tue, 26 Mar 2013 07:33:18 -0700, Michael Herrmann wrote: >> As long as you know the program is going to be simple, pile on the >> globals. But as soon as it advances, each of them is a trap to fall >> into. > > You're right with everything you say. globals are bad and it may happen > that thi

Re: import in Python3.3

2013-03-26 Thread Rocky Bernstein
On Tue, Mar 26, 2013 at 5:16 PM, Phil Connell wrote: > On Tue, Mar 26, 2013 at 08:37:00AM -0700, rocky wrote: > > And again, I get the impression that for the use case asked about, there > isn't much ambiguity. If I am in mypackage.foo and I want to access > mypackage.collections I should be able

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

2013-03-26 Thread Mitya Sirenef
On 03/26/2013 10:59 AM, Michael Herrmann wrote: On Tuesday, March 26, 2013 2:41:38 PM UTC+1, Mitya Sirenef wrote: >> ... >> At the __exit__, further commands are no longer routed to that window; >> if it was a nested context, window is switched to the outer context, >> WHEN there are commands i

MySQLdbd error. Perhpas it isn't installed?

2013-03-26 Thread Νίκος Γκρ33κ
Hello today i deiced to go form python 2.6 to python 3.2.3 although in 2.6 my script runs in the ht enewest python i ge this error: Traceback (most recent call last): File "/opt/python3/lib/python3.2/site-packages/MySQL_python-1.2.3-py3.2-linux-x86_64.egg/MySQLdb/cursors.py", line 171, in ex

Re: Performance of int/long in Python 3

2013-03-26 Thread Dave Angel
On 03/26/2013 05:14 PM, Chris Angelico 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 gets around, a bit, but never seems to do anything very useful. I'd think twic

Re: Performance of int/long in Python 3

2013-03-26 Thread Mark Lawrence
On 26/03/2013 21:14, Chris Angelico wrote: On Wed, Mar 27, 2013 at 8:08 AM, Grant Edwards wrote: On 2013-03-26, Mark Lawrence wrote: On 26/03/2013 20:44, jmfauth wrote: A character is not an integer (short form). So? A character is not an integer. jmf But you are an idiot. I think

Re: import in Python3.3

2013-03-26 Thread Phil Connell
On Tue, Mar 26, 2013 at 08:37:00AM -0700, rocky wrote: > And again, I get the impression that for the use case asked about, there > isn't much ambiguity. If I am in mypackage.foo and I want to access > mypackage.collections I should be able to say something like that without > ambiguity or that

Re: Performance of int/long in Python 3

2013-03-26 Thread Chris Angelico
On Wed, Mar 27, 2013 at 8:08 AM, Grant Edwards wrote: > On 2013-03-26, Mark Lawrence wrote: >> On 26/03/2013 20:44, jmfauth wrote: > A character is not an integer (short form). So? >>> >>> A character is not an integer. >>> >>> jmf >> >> But you are an idiot. > > I think we all

Re: Performance of int/long in Python 3

2013-03-26 Thread Grant Edwards
On 2013-03-26, Mark Lawrence wrote: > On 26/03/2013 20:44, jmfauth wrote: >>> A character is not an integer (short form). >>> >>> So? >> >> A character is not an integer. >> >> jmf > > But you are an idiot. I think we all agree that jmf is a character. So we've established that no character

Re: Performance of int/long in Python 3

2013-03-26 Thread Mark Lawrence
On 26/03/2013 20:44, jmfauth wrote: On 26 mar, 20:03, Chris Angelico wrote: On Wed, Mar 27, 2013 at 5:50 AM, jmfauth wrote: On 25 mar, 22:51, Chris Angelico wrote: The Python 3 merge of int and long has effectively penalized small-number arithmetic by removing an optimization. As we've seen

Re: Performance of int/long in Python 3

2013-03-26 Thread Chris Angelico
On Wed, Mar 27, 2013 at 7:44 AM, jmfauth wrote: > On 26 mar, 20:03, Chris Angelico wrote: >> On Wed, Mar 27, 2013 at 5:50 AM, jmfauth wrote: >> > On 25 mar, 22:51, Chris Angelico wrote: >> >> The Python 3 merge of int and long has effectively penalized >> >> small-number arithmetic by removing

Re: problem with sys import argv

2013-03-26 Thread Dave Angel
On 03/26/2013 04:12 PM, Thomas 'PointedEars' Lahn wrote: Dave Angel wrote: Since the script takes a mandatory argument, run it with one. python myscript.py Dave Better would be to change the script to check len(argv) for exactly 2, and tell the user how he should have run it. I would use

Re: Performance of int/long in Python 3

2013-03-26 Thread jmfauth
On 26 mar, 20:03, Chris Angelico wrote: > On Wed, Mar 27, 2013 at 5:50 AM, jmfauth wrote: > > On 25 mar, 22:51, Chris Angelico wrote: > >> The Python 3 merge of int and long has effectively penalized > >> small-number arithmetic by removing an optimization. As we've seen > >> from PEP 393 string

Re: problem with sys import argv

2013-03-26 Thread Thomas 'PointedEars' Lahn
Dave Angel wrote: > Since the script takes a mandatory argument, run it with one. > > python myscript.py Dave > > Better would be to change the script to check len(argv) for exactly 2, > and tell the user how he should have run it. I would use argparse.ArgumentParser instead.

Re: How to define "exec" method on a class object? Get syntax error due to built in command

2013-03-26 Thread Chris Angelico
On Wed, Mar 27, 2013 at 6:24 AM, Kyle wrote: > On Mar 26, 2:43 pm, Chris Angelico wrote: >> On Wed, Mar 27, 2013 at 5:13 AM, Kyle wrote: >> > Thanks for the suggestion. Looks like we currently use 2.3.4. >> >> > This still wouldn't solve the problem because now the user would need to >> > call

Re: How to define "exec" method on a class object? Get syntax error due to built in command

2013-03-26 Thread Kyle
On Mar 26, 2:43 pm, Chris Angelico wrote: > On Wed, Mar 27, 2013 at 5:13 AM, Kyle wrote: > > Thanks for the suggestion. Looks like we currently use 2.3.4. > > > This still wouldn't solve the problem because now the user would need to > > call something like  getattr(wbt, "exec")() instead of >

Re: Performance of int/long in Python 3

2013-03-26 Thread Chris Angelico
On Wed, Mar 27, 2013 at 5:50 AM, jmfauth wrote: > On 25 mar, 22:51, Chris Angelico wrote: >> The Python 3 merge of int and long has effectively penalized >> small-number arithmetic by removing an optimization. As we've seen >> from PEP 393 strings (jmf aside), there can be huge benefits from >> h

Re: Performance of int/long in Python 3

2013-03-26 Thread jmfauth
On 25 mar, 22:51, Chris Angelico wrote: > The Python 3 merge of int and long has effectively penalized > small-number arithmetic by removing an optimization. As we've seen > from PEP 393 strings (jmf aside), there can be huge benefits from > having a single type with multiple representations inter

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

2013-03-26 Thread Chris Angelico
On Wed, Mar 27, 2013 at 4:21 AM, Ethan Furman wrote: > On 03/26/2013 10:06 AM, Wolfgang Maier 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 tell you how to plug that i

[job] Python & AWS /Back-End Developer in New York, NY

2013-03-26 Thread Lana
We are looking for a strong Python Developer to work with our young and energetic team on the Next generation of clients website. This project is the first to implement the modern concepts of Cloud and MongoDB. Job Responsibilities - Creates new and modifies existing software, integrates softwar

Re: How to define "exec" method on a class object? Get syntax error due to built in command

2013-03-26 Thread Chris Angelico
On Wed, Mar 27, 2013 at 5:13 AM, Kyle wrote: > Thanks for the suggestion. Looks like we currently use 2.3.4. > > This still wouldn't solve the problem because now the user would need to call > something like getattr(wbt, "exec")() instead of wbt.exec() like > all the other commands. > > I think

Re: How to define "exec" method on a class object? Get syntax error due to built in command

2013-03-26 Thread Ethan Furman
On 03/26/2013 11:13 AM, Kyle wrote: On Monday, March 25, 2013 4:28:34 PM UTC-4, Kyle wrote: I am using swig to generate our CLI for TCL and Python. In this CLI, we have a subcommand "exec" that is failing to compile in the python case. There seems to be some built-in python command "exec" whic

Re: import in Python3.3

2013-03-26 Thread rocky
On Tuesday, March 26, 2013 12:33:54 PM UTC-4, Jerry Hill wrote: > On Mon, Mar 25, 2013 at 11:49 PM, rocky wrote: > > >> On Sun, 24 Mar 2013 18:12:49 -0500, Fabian von Romberg wrote: > > >> > I have a package name collections and inside of my package I want to > > > > > I find this kind of thin

Re: Performance of int/long in Python 3

2013-03-26 Thread Terry Reedy
On 3/26/2013 12:41 PM, Cousin Stanley wrote: So where's the difference with your system ? CPU Compilers and compiler settings can also make a difference. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: How to define "exec" method on a class object? Get syntax error due to built in command

2013-03-26 Thread Kyle
On Monday, March 25, 2013 4:28:34 PM UTC-4, Kyle wrote: > I am using swig to generate our CLI for TCL and Python. In this CLI, we have > a subcommand "exec" that is failing to compile in the python case. There > seems to be some built-in python command "exec" which is giving a syntax > error in

Re: problem with sys import argv

2013-03-26 Thread Dave Angel
On 03/26/2013 01:26 PM, leonardo selmi wrote: hi python community, i wrote the following programm: from sys import argv script, userName = argv prompt = '> ' print 'hi %s, i am the %s script' % (userName, script) print "i'd like to ask you a few questions." print 'do you like me %s' % userNam

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

2013-03-26 Thread Neil Cerutti
On 2013-03-26, 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 normally None, but allows a user to >>

Re: problem with sys import argv

2013-03-26 Thread Mark Lawrence
On 26/03/2013 17:26, leonardo selmi wrote: hi python community, i wrote the following programm: from sys import argv script, userName = argv prompt = '> ' print 'hi %s, i am the %s script' % (userName, script) print "i'd like to ask you a few questions." print 'do you like me %s' % userName l

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

2013-03-26 Thread Ethan Furman
On 03/26/2013 10:06 AM, Wolfgang Maier 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 tell you how to plug that in, but a ternary expression is a good fit here. ChrisA Unfortunately, that's n

Re: Help with zip in a Python exercise

2013-03-26 Thread Joel Goldstick
On Tue, Mar 26, 2013 at 1:06 PM, wrote: > I've been working through a Python tutorial online and one of the > exercises uses the zip command. The only problem is that the command > doesn't work. I've read through the man page for zip and it looks like > what I'm attempting should work, but it d

problem with sys import argv

2013-03-26 Thread leonardo selmi
hi python community, i wrote the following programm: from sys import argv script, userName = argv prompt = '> ' print 'hi %s, i am the %s script' % (userName, script) print "i'd like to ask you a few questions." print 'do you like me %s' % userName likes = raw_input(prompt) print "where do you

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

2013-03-26 Thread Peter Otten
Wolfgang Maier 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 tell you how to plug that in, >> but a ternary expression is a good fit here. >> >> ChrisA >> > > Unfortunately

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

2013-03-26 Thread Chris Angelico
On Wed, Mar 27, 2013 at 4:06 AM, Wolfgang Maier 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 tell you how to plug that in, >> but a ternary expression is a good fit here. >> >>

Help with zip in a Python exercise

2013-03-26 Thread luggw1
I've been working through a Python tutorial online and one of the exercises uses the zip command. The only problem is that the command doesn't work. I've read through the man page for zip and it looks like what I'm attempting should work, but it doesn't. The command is: zip -qr /media/backup

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

2013-03-26 Thread Wolfgang Maier
Chris Angelico gmail.com> writes: > > Try printing out this expression: > > "%.2f"%value if value else '' > > Without the rest of your code I can't tell you how to plug that in, > but a ternary expression is a good fit here. > > ChrisA > Unfortunately, that's not working, but gives a TypeErr

Re: Performance of int/long in Python 3

2013-03-26 Thread Chris Angelico
On Wed, Mar 27, 2013 at 3:41 AM, Cousin Stanley wrote: > > Chris Angelico wrote: > >> Once again, Py3 is slower on small integers than Py2. > > Chris Angelico > Ubuntu Karmic. > Pentium(R) Dual-Core CPU E6500 @ 2.93GHz. > > python inline range_sum forloop forloop_offset > > 2.6.4

Re: Performance of int/long in Python 3

2013-03-26 Thread Cousin Stanley
Chris Angelico wrote: > Once again, Py3 is slower on small integers than Py2. Chris Angelico Ubuntu Karmic. Pentium(R) Dual-Core CPU E6500 @ 2.93GHz. python inline range_sum forloop forloop_offset 2.6.4 2.7050 2.6492 6.5877 16.5168 3.1.1 4.4453 4.3731 12

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

2013-03-26 Thread Dave Angel
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 normally None, but allows a user to provide a prefered focus window? enter_text("test.tx

Re: import in Python3.3

2013-03-26 Thread Jerry Hill
On Mon, Mar 25, 2013 at 11:49 PM, rocky wrote: >> On Sun, 24 Mar 2013 18:12:49 -0500, Fabian von Romberg wrote: >> > I have a package name collections and inside of my package I want to > I find this kind of thing sad: it feels to me that programmers are working > around somewhat arbitrary and c

Samsung Galaxy Mini

2013-03-26 Thread 23alagmy
Samsung Galaxy Mini http://natigtas7ab.blogspot.com/2012/10/samsung-galaxy-mini.html -- http://mail.python.org/mailman/listinfo/python-list

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

2013-03-26 Thread John Gordon
In c...@isbd.net writes: > What's a neat way to print columns of numbers with blanks where a number > is zero or None? print number or ' ' -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears

Simple example of how to use importlib to create a loader

2013-03-26 Thread Paul Moore
I'm trying to write my own loader using importlib. And frankly, I'm getting nowhere. I'm struggling to understand precisely which methods of the various ABCs I need to implement, and in some cases what they should do. Could anyone point me to a simple example (say, something that implements zip

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

2013-03-26 Thread Chris Angelico
On Wed, Mar 27, 2013 at 2:50 AM, wrote: > What's a neat way to print columns of numbers with blanks where a number > is zero or None? > > E.g. I want to output something like:- > > Credit Debit Description > 100.00 Initial balance > 123.45 Payment for

I need a neat way to print nothing or a number

2013-03-26 Thread cl
What's a neat way to print columns of numbers with blanks where a number is zero or None? E.g. I want to output something like:- Credit Debit Description 100.00 Initial balance 123.45 Payment for cabbages 202.00 Telephone bill For ea

Re: import in Python3.3

2013-03-26 Thread rocky
On Tuesday, March 26, 2013 3:04:44 AM UTC-4, Terry Reedy wrote: > On 3/24/2013 7:12 PM, Fabian von Romberg wrote: > > > Hi, > > > > > > I have a package name collections and inside of my package I want to > > > import the collections package from the standard library, but there > > > is name c

Re: Processing user input as it's entered

2013-03-26 Thread Sven
On 26 March 2013 14:41, Arnaud Delobelle wrote: > On 26 March 2013 10:07, Sven wrote: > > Hello, > > > > Is there a way (ideally cross platform but a *nix OS solution would be > > great) to process user input as they type? > > What I aim to achieve is to count the number of characters a user has

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

2013-03-26 Thread Chris Angelico
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 this will (or might - if the file's already been named, Ctrl-S won't open a dlg) chan

Re: python3 string format

2013-03-26 Thread Ian Kelly
On Tue, Mar 26, 2013 at 4:51 AM, Shiyao Ma wrote: > Thx for your reply. > I am using pycharm and simply press "go to declaration" which directs me to > a py file, containing the following code: > def format(*args, **kwargs): # known special case of str.format > """ > S.format(*args

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

2013-03-26 Thread Michael Herrmann
On Tuesday, March 26, 2013 2:41:38 PM UTC+1, Mitya Sirenef wrote: > ... > At the __exit__, further commands are no longer routed to that window; > if it was a nested context, window is switched to the outer context, > WHEN there are commands in it (i.e. on the first command). This seems > pretty i

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

2013-03-26 Thread Michael Herrmann
On Tuesday, March 26, 2013 3:13:30 PM UTC+1, Neil Cerutti wrote: > On 2013-03-25, Mitya Sirenef wrote: > > > I think I would prefer context managers. I don't think it's a > > big problem for win users because this behaviour would be one > > of the first things documented in the start guide and wou

Re: Processing user input as it's entered

2013-03-26 Thread Arnaud Delobelle
On 26 March 2013 10:07, Sven wrote: > Hello, > > Is there a way (ideally cross platform but a *nix OS solution would be > great) to process user input as they type? > What I aim to achieve is to count the number of characters a user has > entered and display it while they are typing. The entered t

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

2013-03-26 Thread Michael Herrmann
On Tuesday, March 26, 2013 1:42:26 PM UTC+1, Dave Angel wrote: > ... > > Also, it seems that in this thread, we are using "window" both to refer > to a particular application instance (like Notepad1 and Notepad2), and > to refer to windows within a single application. > > > > Anyway, if you'r

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

2013-03-26 Thread Michael Herrmann
On Tuesday, March 26, 2013 1:59:58 PM UTC+1, Steven D'Aprano wrote: > On Tue, 26 Mar 2013 05:04:43 -0700, Michael Herrmann wrote: > ... > Am I the only one who appreciates the simplicity of > > > start("Notepad") > > write("Hello World!") > > press(CTRL + 's') > > w

Is it me or is the python-vobject documentation rather lacking?

2013-03-26 Thread cl
I'm trying to use the python vobject package instead of what I use at the moment (the icalendar package) because it's more widely supported and available from my Linux repository. However I'm having a really hard time actually working out how to use it. The 'Usage examples' at http://vobject.skyho

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

2013-03-26 Thread Neil Cerutti
On 2013-03-25, Mitya Sirenef wrote: > I think I would prefer context managers. I don't think it's a > big problem for win users because this behaviour would be one > of the first things documented in the start guide and would be > all over example scripts, so a new user missing or forgetting > it

Re: Performance of int/long in Python 3

2013-03-26 Thread Chris Angelico
On Wed, Mar 27, 2013 at 12:38 AM, Cousin Stanley wrote: > Chris Angelico wrote: > >> Interesting, so your 3.x sum() is optimizing something somewhere. >> Strange. Are we both running the same Python ? >> >> I got those from apt-get >> > > I also installed python here under Debian Wheezy >

Re: Performance of int/long in Python 3

2013-03-26 Thread Cousin Stanley
Chris Angelico wrote: > Interesting, so your 3.x sum() is optimizing something somewhere. > Strange. Are we both running the same Python ? > > I got those from apt-get > I also installed python here under Debian Wheezy via apt-get and our versions look to be the same -sk-

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

2013-03-26 Thread Mitya Sirenef
On 03/26/2013 05:38 AM, Michael Herrmann wrote: On Tuesday, March 26, 2013 12:40:45 AM UTC+1, Mitya Sirenef wrote: >> ... >> >> I think I would prefer context managers. I don't think it's a big >> problem for >> win users because this behaviour would be one of the first things documented >> i

Re: Performance of int/long in Python 3

2013-03-26 Thread Roy Smith
In article <51512bb5$0$29973$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > On Mon, 25 Mar 2013 20:55:03 -0400, Roy Smith wrote: > > > In article <5150e900$0$29998$c3e8da3$54964...@news.astraweb.com>, > > Steven D'Aprano wrote: > > > >> Also, speaking as somebody who remembers

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

2013-03-26 Thread Steven D'Aprano
On Tue, 26 Mar 2013 05:04:43 -0700, Michael Herrmann wrote: > On Tuesday, March 26, 2013 11:26:30 AM UTC+1, Dave Angel wrote: >> ... >> Seems to me that the official interface should all be methods. >> However, you could have a new object which always represents the >> "focus" window. >> Then t

Re: [WSGI] Tell Python to listen to LAN interface?

2013-03-26 Thread Gilles
On Tue, 26 Mar 2013 23:50:36 +1100, Chris Angelico wrote: >According to the docstring, the first argument to make_server() is the >host name to bind to. Using "localhost" means you're bound to >127.0.0.1, as you see. Use your LAN IP address there, or "" to bind to >all local addresses - or possibl

Re: [WSGI] Tell Python to listen to LAN interface?

2013-03-26 Thread Chris Angelico
On Tue, Mar 26, 2013 at 11:26 PM, Gilles wrote: > Hello > > I'm following this tutorial to learn about writing Python apps in > WSGI: > > http://webpython.codepoint.net/wsgi_tutorial I'm guessing you're using the initialization code from here? http://webpython.codepoint.net/wsgi_environment_dict

Re: At a loss on python scoping.

2013-03-26 Thread Steven D'Aprano
On Tue, 26 Mar 2013 14:19:21 +0800, Shiyao Ma wrote: > PS, I now python's scoping rule is lexical rule (aka static rule). How > does LEGB apply to class? It doesn't. Python does not use the same lookup rules for attributes and unqualified names. Attribute lookups follow inheritance rules. `inst

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

2013-03-26 Thread Dave Angel
On 03/26/2013 08:04 AM, Michael Herrmann wrote: On Tuesday, March 26, 2013 11:26:30 AM UTC+1, Dave Angel wrote: ... Seems to me that the official interface should all be methods. However, you could have a new object which always represents the "focus" window. Then the USER could define trivi

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

2013-03-26 Thread Michael Herrmann
On Tuesday, March 26, 2013 1:16:56 PM UTC+1, Jean-Michel Pichavant wrote: > - Original Message - > > > > notepad_1 = start("Notepad") > > > > notepad_2 = start("Notepad") > > > > notepad_1.write("Hello World!") > > > > notepad_1.press(CTRL + 'a', CTRL + 'c')

[WSGI] Tell Python to listen to LAN interface?

2013-03-26 Thread Gilles
Hello I'm following this tutorial to learn about writing Python apps in WSGI: http://webpython.codepoint.net/wsgi_tutorial On a Linux host with Python 2.6.6 installed, I launched the "Environment dictionary" sample, but can't connect to it from my remote Windows host since the application only a

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

2013-03-26 Thread Michael Herrmann
On Tuesday, March 26, 2013 12:57:21 PM UTC+1, Chris Angelico wrote: > On Tue, Mar 26, 2013 at 10:52 PM, Michael Herrmann > > Doesn't the IPython do auto-completion for "global" functions? > > Even if it does, it'll be polluted with every other global. Methods > don't have that problem. On the flip

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

2013-03-26 Thread Michael Herrmann
On Tuesday, March 26, 2013 12:43:18 PM UTC+1, Chris Angelico wrote: > On Tue, Mar 26, 2013 at 8:38 PM, Michael Herrmann > > > What do you think of designs #3 and #4? > > > notepad_1 = start("Notepad") > > notepad_2 = start("Notepad") > > switch_to(notepad_1) > > wr

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

2013-03-26 Thread Jean-Michel Pichavant
- Original Message - > On Tuesday, March 26, 2013 11:07:45 AM UTC+1, Jean-Michel Pichavant > wrote: > > - Original Message - > > > notepad_1 = start("Notepad") > > > notepad_2 = start("Notepad") > > > notepad_1.write("Hello World!") > > > notepad_1.press(CTRL + 'a', CTRL +

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

2013-03-26 Thread Michael Herrmann
On Tuesday, March 26, 2013 12:38:35 PM UTC+1, Chris Angelico wrote: > ... > Fundamental point: As I understand the API, it doesn't *actually* tie > to a window. You don't locate the Notepad window and send it keys - > you switch focus to Notepad and then send keys to the whole system. Is > this cor

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

2013-03-26 Thread Michael Herrmann
On Tuesday, March 26, 2013 11:26:30 AM UTC+1, Dave Angel wrote: > ... > Seems to me that the official interface should all be methods. However, > you could have a new object which always represents the "focus" window. > Then the USER could define trivial functions: > > def write(*args): >

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

2013-03-26 Thread Chris Angelico
On Tue, Mar 26, 2013 at 10:52 PM, Michael Herrmann wrote: > Doesn't the IPython do auto-completion for "global" functions? Even if it does, it'll be polluted with every other global. Methods don't have that problem. On the flip side, since presumably this is (will be) a module, anyone who wants a

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

2013-03-26 Thread Michael Herrmann
On Tuesday, March 26, 2013 11:07:45 AM UTC+1, Jean-Michel Pichavant wrote: > - Original Message - > > notepad_1 = start("Notepad") > > notepad_2 = start("Notepad") > > notepad_1.write("Hello World!") > > notepad_1.press(CTRL + 'a', CTRL + 'c') > > notepad_2.press(CTRL +

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

2013-03-26 Thread Chris Angelico
On Tue, Mar 26, 2013 at 8:38 PM, Michael Herrmann wrote: > What do you think of designs #3 and #4? > > notepad_1 = start("Notepad") > notepad_2 = start("Notepad") > switch_to(notepad_1) > write("Hello World!") > press(CTRL + 'a', CTRL + 'c') > switch

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

2013-03-26 Thread Chris Angelico
On Tue, Mar 26, 2013 at 7:53 PM, Michael Herrmann wrote: > On Monday, March 25, 2013 10:08:53 PM UTC+1, Chris Angelico wrote: >> ... >> > I kind of like the context manager solution because the indentation makes >> > it very obvious what happens in which window. You are right about our >> > targ

Re: At a loss on python scoping.

2013-03-26 Thread Shiyao Ma
After read Dave's answer, I think I confused LEGB with attribute lookup. So, a.r has nothing to do with LEGB. On Tue, Mar 26, 2013 at 7:03 PM, Shiyao Ma wrote: > Thx, really a nice and detailed explanation. > > > On Tue, Mar 26, 2013 at 6:07 PM, Dave Angel wrote: > >> On 03/26/2013 02:17 AM, Sh

Re: At a loss on python scoping.

2013-03-26 Thread Shiyao Ma
Thx, really a nice and detailed explanation. On Tue, Mar 26, 2013 at 6:07 PM, Dave Angel wrote: > On 03/26/2013 02:17 AM, Shiyao Ma wrote: > >> Hi, >> suppose I have a file like this: >> class A: >> r = 5 >> def func(self, s): >> self.s = s >> a = A() >> print(a.r)# this s

Re: JES account balance function help urgent!

2013-03-26 Thread Dave Angel
On 03/26/2013 06:30 AM, kidom...@gmail.com wrote: I am supposed to complete the following five functions, i have no idea how to do this. I will greatly appreciate any help The following five functions allow you to maintain the running balance of an account and print out lines relating to each

Re: python3 string format

2013-03-26 Thread Shiyao Ma
Thx for your reply. I am using pycharm and simply press "go to declaration" which directs me to a py file, containing the following code: def format(*args, **kwargs): # known special case of str.format """ S.format(*args, **kwargs) -> string Return a formatted version of S,

  1   2   >