Re: merge stdin, stdout?

2010-02-05 Thread jonny lowe
On Feb 4, 8:20 pm, exar...@twistedmatrix.com wrote: > On 01:56 am, jonny.lowe.12...@gmail.com wrote: > > > > >Hi everyone, > > >Is there an easy way to mergestdinandstdout? For instance suppose I > >havescriptthat prompts for a number and prints the number. If you > >execute this with redirection f

Re: How to guard against bugs like this one?

2010-02-05 Thread MRAB
Stephen Hansen wrote: On Fri, Feb 5, 2010 at 12:16 PM, John Nagle > wrote: kj wrote: Through a *lot* of trial an error I finally discovered that the root cause of the problem was the fact that, in the same directory as buggy.py, there is *an

Re: method to intercept string formatting % operations

2010-02-05 Thread Raymond Hettinger
On Feb 5, 6:57 am, bradallen wrote: > Hello, > > For container class derived from namedtuple, but which also behaves > like a dictionary by implementing __getitem__ for non-integer index > values, is there a special reserved method which allows intercepting % > string formatting operations? I woul

Re: Python and Ruby

2010-02-05 Thread Robert Kern
On 2010-02-04 17:46 PM, Ethan Furman wrote: Robert Kern wrote: On 2010-02-04 14:55 PM, Jonathan Gardner wrote: On Feb 3, 3:39 pm, Steve Holden wrote: Robert Kern wrote: On 2010-02-03 15:32 PM, Jonathan Gardner wrote: I can explain all of Python in an hour; I doubt anyone will understand al

Re: C:\Python25\Lib\IDLELIB\idle.pyw won't start

2010-02-05 Thread Anthra Norell
Duncan Booth wrote: Anthra Norell wrote: Using pythonw.exe will start the program with all error output dumped in the bit bucket. Running from a command prompt with python.exe will at least let you see if there are any errors. python.exe from the command line works all right in a

Re: Your beloved python features

2010-02-05 Thread Bruce C. Baker
"George Sakkis" wrote in message news:de06116c-e77c-47c4-982d-62b48bca5...@j31g2000yqa.googlegroups.com... I'll give the benefit of doubt and assume you're joking rather than trolling. George * Not trolling, my friend! GvR got it

Re: Editor for Python

2010-02-05 Thread Alan Harris-Reid
Hi Laszlo, I use Wing IDE (not free, $35 for personal edition) and PyScripter (free). I find both good, for different reasons. Regards, Alan Laszlo Nagy wrote: Hi All, I know that this question was put up on this

Re: Python and Ruby

2010-02-05 Thread Ethan Furman
Robert Kern wrote: On 2010-02-04 17:46 PM, Ethan Furman wrote: Robert Kern wrote: On 2010-02-04 14:55 PM, Jonathan Gardner wrote: On Feb 3, 3:39 pm, Steve Holden wrote: Robert Kern wrote: On 2010-02-03 15:32 PM, Jonathan Gardner wrote: I can explain all of Python in an hour; I doubt anyon

Re: How to guard against bugs like this one?

2010-02-05 Thread Ethan Furman
John Nagle wrote: kj wrote: ... Through a *lot* of trial an error I finally discovered that the root cause of the problem was the fact that, in the same directory as buggy.py, there is *another* innocuous little script, totally unrelated, whose name happens to be numbers.py. The right ans

Re: method names nounVerb or verbNoun

2010-02-05 Thread Wanderer
On Feb 5, 3:26 pm, Chris Rebert wrote: > On Fri, Feb 5, 2010 at 11:53 AM, Wanderer wrote: > > Which is the more accepted way to compose method names nounVerb or > > verbNoun? > > > For example voltageGet or getVoltage? getVoltage sounds more normal, > > but voltageGet is more like voltage.Get. I

Re: method names nounVerb or verbNoun

2010-02-05 Thread Chris Rebert
On Fri, Feb 5, 2010 at 1:49 PM, Wanderer wrote: > On Feb 5, 3:26 pm, Chris Rebert wrote: >> On Fri, Feb 5, 2010 at 11:53 AM, Wanderer wrote: >> > Which is the more accepted way to compose method names nounVerb or >> > verbNoun? >> >> > For example voltageGet or getVoltage? getVoltage sounds more

Re: method names nounVerb or verbNoun

2010-02-05 Thread Alf P. Steinbach
* Wanderer: On Feb 5, 3:26 pm, Chris Rebert wrote: On Fri, Feb 5, 2010 at 11:53 AM, Wanderer wrote: Which is the more accepted way to compose method names nounVerb or verbNoun? For example voltageGet or getVoltage? getVoltage sounds more normal, but voltageGet is more like voltage.Get. I seem

Re: Your beloved python features

2010-02-05 Thread CM
> GvR got it right when he discarded the superfluous semicolons from the ends > of statements--and then he ADDS superfluous colons to the ends of control > statements? It will probably be as much of a shock to you as it was to me > when I learned after studying parsing that colons, semicolons, "th

Re: YAML (was: Python and Ruby)

2010-02-05 Thread Steven D'Aprano
On Fri, 05 Feb 2010 09:22:03 -0500, Lou Pecora wrote: [...] >> > That's what I needed. 3 lines to write or read a inhomogeneous >> > collection of variables. >> >> Easy, but also quick and dirty -- good enough for small scripts, but >> not really good enough for production applications. [...] >

Re: which

2010-02-05 Thread Steven D'Aprano
On Fri, 05 Feb 2010 16:52:19 +0100, mk wrote: > assert isinstance(cmd, basestring) or cmd is None, "cmd should be string > or None" Do not use assertions for input validation. That's not what they're for. assert is compiled away when you run your code with the -O switch, which means that the te

Re: method to intercept string formatting % operations

2010-02-05 Thread Steven D'Aprano
On Fri, 05 Feb 2010 16:49:00 +0100, Jean-Michel Pichavant wrote: > Anyway why would you want to use the tuple form ? it's beaten in every > aspect by the dictionary form. Except convenience, efficiency and readability. "%s %s" % (1, 2) versus "%(a)s %(b)s" % {'a': 1, 'b': 2} I'm all in favou

reconstruct the source of a lambda from its func_code, func_name, etc

2010-02-05 Thread Phlip
Thy Pon: Has anyone figured out how to reflect a passed function, such as a lambda, all the way back to its source? I am aware than func_code knows the file name and line number; I would rather not use them to read the file because the lambda might not start in the first column. I will go with th

Re: xmlrpc slow in windows 7 if hostnames are used

2010-02-05 Thread News123
Hi Gabriel, Gabriel Genellina wrote: > En Thu, 04 Feb 2010 19:34:20 -0300, News123 escribió: > >> I wrote a small xmlrpc client on Windows 7 with python 2.6 >> >> srv = xmlrpclib.Server('http://localhost:80') >> >> I was able to perform about 1 rpc call per second >> >> After changing to >> srv

Re: which

2010-02-05 Thread Steven D'Aprano
On Fri, 05 Feb 2010 15:21:05 +0100, mk wrote: > if isinstance(cmd, str): > self.cmd = cmd.replace(r'${ADDR}',ip) > else: > self.cmd = cmd > > or > > self.cmd = cmd > if isinstance(cmd, str): > self.cmd = cmd.replace(r'${ADDR}',ip) Whichever one you like. The differences are insi

Re: method names nounVerb or verbNoun

2010-02-05 Thread Wanderer
On Feb 5, 4:53 pm, Chris Rebert wrote: > On Fri, Feb 5, 2010 at 1:49 PM, Wanderer wrote: > > On Feb 5, 3:26 pm, Chris Rebert wrote: > >> On Fri, Feb 5, 2010 at 11:53 AM, Wanderer wrote: > >> > Which is the more accepted way to compose method names nounVerb or > >> > verbNoun? > > >> > For examp

Re: Dreaming of new generation IDE

2010-02-05 Thread bartc
"Steve Holden" wrote in message news:mailman.1998.1265399766.28905.python-l...@python.org... Arnaud Delobelle wrote: Robert Kern writes: I prefer Guido's formulation (which, naturally, I can't find a direct quote for right now): if you expect that a boolean argument is only going to take *

Re: Python's Reference And Internal Model Of Computing Languages

2010-02-05 Thread Steven D'Aprano
On Fri, 05 Feb 2010 09:53:33 -0600, David Thole wrote: > I read thisand am a tiny bit confused about the actual problem. > > It's not exactly complex to realize that something like: a = b = array > that a and b both point to the array. > > Logically speaking, I'm not sure how one could assum

Re: xmlrpc slow in windows 7 if hostnames are used

2010-02-05 Thread News123
Hi JM, Jean-Michel Pichavant wrote: >> Gabriel Genellina wrote: >> >>> En Thu, 04 Feb 2010 19:34:20 -0300, News123 escribió: >>> >>> I wrote a small xmlrpc client on Windows 7 with python 2.6 srv = xmlrpclib.Server('http://localhost:80') I was able to perform about

Re: method names nounVerb or verbNoun

2010-02-05 Thread Steven D'Aprano
On Fri, 05 Feb 2010 11:53:08 -0800, Wanderer wrote: > Which is the more accepted way to compose method names nounVerb or > verbNoun? > > For example voltageGet or getVoltage? getVoltage sounds more normal, +0.5 for getVoltage +1 get_voltage -1 for voltageGet or voltage_get > but > voltageGe

execute sqlite3 dot commands in python

2010-02-05 Thread gintare statkute
Does anybody know if it possible to execute sqlite3 dot commands in python? dovanotas:/pages/links# python Python 2.5.2 (r252:60911, Jan 4 2009, 17:40:26) [GCC 4.3.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import sqlite3 >>> sqlite3 .help Traceback (

Re: Repost: Read a running process output

2010-02-05 Thread Nobody
On Fri, 05 Feb 2010 03:57:17 -0800, Ashok Prabhu wrote: > I very badly need this to work. I have been googling out for a week > with no significant solution. I open a process p1 which does keeps > running for 4+ hours. It gives some output in stdout now and then. I > open this process with subproc

Re: Dreaming of new generation IDE

2010-02-05 Thread Robert Kern
On 2010-02-05 16:22 PM, bartc wrote: "Steve Holden" wrote in message news:mailman.1998.1265399766.28905.python-l...@python.org... Arnaud Delobelle wrote: Robert Kern writes: I prefer Guido's formulation (which, naturally, I can't find a direct quote for right now): if you expect that a boo

Re: method names nounVerb or verbNoun

2010-02-05 Thread Steven D'Aprano
On Fri, 05 Feb 2010 12:26:38 -0800, Chris Rebert wrote: > On Fri, Feb 5, 2010 at 11:53 AM, Wanderer > wrote: >> Which is the more accepted way to compose method names nounVerb or >> verbNoun? >> >> For example voltageGet or getVoltage? getVoltage sounds more normal, >> but voltageGet is more like

Re: reconstruct the source of a lambda from its func_code, func_name, etc

2010-02-05 Thread Steven D'Aprano
On Fri, 05 Feb 2010 14:19:36 -0800, Phlip wrote: > Thy Pon: > > Has anyone figured out how to reflect a passed function, such as a > lambda, all the way back to its source? Use the dis module to disassemble the byte code to human readable form, then write some sort of decompiler to translate it

Re: Your beloved python features

2010-02-05 Thread Steven D'Aprano
On Fri, 05 Feb 2010 18:29:07 +0100, mk wrote: > Ethan Furman wrote: > >> http://www1.american.edu/academic.depts/cas/econ/faculty/isaac/ choose_python.pdf >> >> > Choose to get your difficult questions about threads in Python ignored. > Oh well.. With an attitude like that, you're damn lucky i

Re: xmlrpc slow in windows 7 if hostnames are used

2010-02-05 Thread Steve Holden
News123 wrote: > Hi Gabriel, > > Gabriel Genellina wrote: >> En Thu, 04 Feb 2010 19:34:20 -0300, News123 escribió: >> >>> I wrote a small xmlrpc client on Windows 7 with python 2.6 >>> >>> srv = xmlrpclib.Server('http://localhost:80') >>> >>> I was able to perform about 1 rpc call per second >>>

Re: Your beloved python features

2010-02-05 Thread Steven D'Aprano
On Fri, 05 Feb 2010 15:22:25 -0600, Bruce C. Baker wrote: > GvR got it right when he discarded the superfluous semicolons from the > ends of statements--and then he ADDS superfluous colons to the ends of > control statements? They're not superfluous, they have a real, practical use. > It will

how to make a SimpleXMLRPCServer abort at CTRL-C under windows

2010-02-05 Thread News123
Hi, I'm using an XMLRPC server under Windows. What I wonder is how I could create a server, that can be killed with CTRL-C The server aborts easily with CTRL-BREAK but not with CTRL-C (under Windows) If I press CTRL-C it will only abort when the next RPC call occurs. It seems it is blocking i

Re: SQLite3: preventing new file creation

2010-02-05 Thread Aahz
In article <6cf467a9-99d7-4fda-99da-075b4b38e...@k6g2000prg.googlegroups.com>, Gnarlodious wrote: > >Every time I say something like: > >connection=sqlite3.connect(file) > >sqlite creates a new database file. Can this behavior be suppressed >through SQLite? Or am I forced to check for the file ex

Re: Dreaming of new generation IDE

2010-02-05 Thread Steve Holden
bartc wrote: > > "Steve Holden" wrote in message > news:mailman.1998.1265399766.28905.python-l...@python.org... >> Arnaud Delobelle wrote: >>> Robert Kern writes: >>> I prefer Guido's formulation (which, naturally, I can't find a direct quote for right now): if you expect that a boolea

Re: execute sqlite3 dot commands in python

2010-02-05 Thread Steve Holden
gintare statkute wrote: > Does anybody know if it possible to execute sqlite3 dot commands in python? > > dovanotas:/pages/links# python > Python 2.5.2 (r252:60911, Jan 4 2009, 17:40:26) > [GCC 4.3.2] on linux2 > Type "help", "copyright", "credits" or "license" for more information. import s

Re: Dreaming of new generation IDE

2010-02-05 Thread Steven D'Aprano
On Fri, 05 Feb 2010 22:22:39 +, bartc wrote: > "Steve Holden" wrote in message > news:mailman.1998.1265399766.28905.python-l...@python.org... >> Arnaud Delobelle wrote: >>> Robert Kern writes: >>> I prefer Guido's formulation (which, naturally, I can't find a direct quote for right

Re: method names nounVerb or verbNoun

2010-02-05 Thread Chris Rebert
On Fri, Feb 5, 2010 at 2:45 PM, Steven D'Aprano wrote: > On Fri, 05 Feb 2010 12:26:38 -0800, Chris Rebert wrote: >> On Fri, Feb 5, 2010 at 11:53 AM, Wanderer >> wrote: >>> Which is the more accepted way to compose method names nounVerb or >>> verbNoun? >>> >>> For example voltageGet or getVoltage

Re: list.extend([]) Question

2010-02-05 Thread Jack Diederich
On Fri, Feb 5, 2010 at 11:31 AM, Gerald Britton wrote: > I think it's because when you do ['a'].extend([]) or whatever, the > result is whatever the method "extend" returns.  But "extend" has no > return value, hence you will see None if you do this interactively. > That sums it up. In Python th

Re: Your beloved python features

2010-02-05 Thread Tim Chase
Steven D'Aprano wrote: Trailing spaces and tabs, on the other hand, *are* invisible. But they're also insignificant, and so don't matter. (Except for one little tiny corner case, which I shall leave as an exercise for the advanced reader.) Drat, now I'm gonna be up at odd hours tonight dredg

Calendar GUI

2010-02-05 Thread William Gaggioli
Hello Everyone, I'm working on setting up some software for a Peruvian non-profit to help them organize their incoming volunteers. One of the features I'd like to add is a calendar-like view of the different volunteers arrival dates and staying time, with potentially some other info through some d

Re: Calendar GUI

2010-02-05 Thread Gabriel
On Fri, Feb 5, 2010 at 9:08 PM, William Gaggioli wrote: > Hello Everyone, > > I'm working on setting up some software for a Peruvian non-profit to help > them organize their incoming volunteers. One of the features I'd like to add > is a calendar-like view of the different volunteers arrival dates

Re: Google AI Challenge at U of Waterloo

2010-02-05 Thread **Group User**
On Feb 6, 7:02 am, Forthminder wrote: > Contest runs from 4 February to 26 February 2010. > > You may choose a programming language, such as > Java, C++, Python, Ruby or Haskell. > > See details at > > http://csclub.uwaterloo.ca/contest/problem_description.php > > Bonne Chance! > > Mentifex > --ht

Re: Exception class documentation

2010-02-05 Thread Charles Yeomans
On Feb 5, 2010, at 2:13 PM, Gerald Britton wrote: On Fri, Feb 5, 2010 at 12:55 PM, Charles Yeomans > wrote: I am so far unable to find the information I want about the Exception class. Information like the signature of __init__ seems to be unavailable. Any suggestions where I might find s

can pydoc display doc for local funcs? or other doc tools for own code

2010-02-05 Thread News123
Hi, often I start "pydoc -g" in a projects working directory in order to view the docstrings of my own project and in order to get a quick overview of the code structure In some cases I would like to see also to see private methods (especially when trying to understand the internals of a collegu

Re: how to make a SimpleXMLRPCServer abort at CTRL-C under windows

2010-02-05 Thread Gabriel Genellina
En Fri, 05 Feb 2010 20:03:51 -0300, News123 escribió: I'm using an XMLRPC server under Windows. What I wonder is how I could create a server, that can be killed with CTRL-C The server aborts easily with CTRL-BREAK but not with CTRL-C (under Windows) If I press CTRL-C it will only abort

Re: Drawing a zig-zag Trail in Python?

2010-02-05 Thread W. eWatson
On 2/5/2010 9:30 AM, Grant Edwards wrote: On 2010-02-05, W. eWatson wrote: I'd like to draw something like an animal track. Between each point is a line. Perhaps the line would have an arrow showing the direction of motion. There should be x-y coordinates axises. PIL? MatPlotLib, ?? I'd prob

"Nim" game being created, no GUI used... Need tips...

2010-02-05 Thread Jordan Uchima
I am creating a game called Nim, but cannot get a loop going no matter what I do. What i am trying to do is get it to only accept input from 1 to 4, and keep asking for input from the same player if he/she enters in an invalid number. I also want it to stop when there is 1 or no piece(s) left, and

Re: Google AI Challenge at U of Waterloo

2010-02-05 Thread Man-wai Chang to The Door (24000bps)
On 06-Feb-10 08:02, Forthminder wrote: Contest runs from 4 February to 26 February 2010. http://csclub.uwaterloo.ca/contest/problem_description.php Bonne Chance! It's definitely *not* exactly a programming challenge, but algorithm challenge. A programming (only) challenge should only require

Re: [PyOpenGL-Users] Mouse wheel events?

2010-02-05 Thread Gary Herron
Craig Berry wrote: Is there any way to get mouse wheel events from glut in PyOpenGL? Use Linux. (On Linux, Glut returns mouse wheel events as buttons 4 and 5), or use FreeGlut. On both Windows and Linux freeglut returns mouse wheel events as buttons 4 and 5. Gary Herron -- http://mai

WCK and PIL

2010-02-05 Thread darnzen
I've written an app using the wck library (widget construction kit, see http://www.effbot.org), in addition to the wckGraph module. What I'd like to do, is take the output of one of my windows (happens to be a graph), and save it as a *.png or *.gif. I was planning on using the PIL for this. I'd li

Re: merge stdin, stdout?

2010-02-05 Thread Gabriel Genellina
En Fri, 05 Feb 2010 17:39:07 -0300, jonny lowe escribió: On Feb 4, 8:20 pm, exar...@twistedmatrix.com wrote: On 01:56 am, jonny.lowe.12...@gmail.com wrote: >What I want is to have an easy way to merge input.txt and thestdout >so that output.txt look like: >Enter a number: 42 >You entered 42

Re: Import question

2010-02-05 Thread Gabriel Genellina
En Fri, 05 Feb 2010 13:21:47 -0300, Andrew Degtiariov escribió: Code of our project has split into several packages and we deploy the project using buildout. All worked fine until I need to dynamically inspect python modules. Entirely by luck, I'd say :) ├───project.api.config │ ├───proje

Re: Dreaming of new generation IDE

2010-02-05 Thread Gabriel Genellina
En Fri, 05 Feb 2010 19:22:39 -0300, bartc escribió: "Steve Holden" wrote in message news:mailman.1998.1265399766.28905.python-l...@python.org... Arnaud Delobelle wrote: Robert Kern writes: I prefer Guido's formulation (which, naturally, I can't find a direct quote for right now): if you e

Re: C:\Python25\Lib\IDLELIB\idle.pyw won't start

2010-02-05 Thread Gabriel Genellina
En Fri, 05 Feb 2010 10:23:57 -0300, Anthra Norell escribió: I upgraded from 2.4 to 2.5 and am unable to start an 2.5 idle window. The OS is Windows ME. The download of 2.5 finished with a warning saying that 2.5 was the highest version for Windows 9* Any tips? I'd suggest a couple more

Re: Simple question about Queue.Queue and threads

2010-02-05 Thread Gabriel Genellina
En Fri, 05 Feb 2010 09:45:30 -0300, Frank Millman escribió: Assume you have a server process running, a pool of worker threads to perform tasks, and a Queue.Queue() to pass the tasks to the workers. In order to shut down the server cleanly, you want to ensure that the workers have all fi

Re: Simple question about Queue.Queue and threads

2010-02-05 Thread Frank Millman
On Feb 6, 7:59 am, "Gabriel Genellina" wrote: En Fri, 05 Feb 2010 09:45:30 -0300, Frank Millman escribió: [...] > However, the queue is not empty - it still has the final None in it. Yes - but who cares? :) That was my point. I didn't think I needed to care, but I wanted to be sure I w

Re: Calendar GUI

2010-02-05 Thread Michael Torrie
Gabriel wrote: > On Fri, Feb 5, 2010 at 9:08 PM, William Gaggioli wrote: >> I'm working on setting up some software for a Peruvian non-profit to help >> them organize their incoming volunteers. One of the features I'd like to add >> is a calendar-like view of the different volunteers arrival dates

<    1   2