Re: do people really complain about significant whitespace?

2006-08-07 Thread Jim
> He points out that if some code gets accidentally dedented, it is > difficult for another programmer to determine which lines were supposed > to be in the indented block. I pointed out that if someone > accidentally moves a curly brace, the same problem can occur. > Anecdotally, I've never had e

Re: singleton decorator

2006-08-07 Thread Erik Max Francis
Andre Meyer wrote: > Am I missing something here? What is the preferred pythonic way of > implementing singleton elegantly? Create a class and then derive from it. There are examples on the Cookbook. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA &

Re: singleton decorator

2006-08-07 Thread Pedro Werneck
On Tue, 8 Aug 2006 01:33:31 +0200 "Andre Meyer" <[EMAIL PROTECTED]> wrote: > > Am I missing something here? What is the preferred pythonic way of > implementing singleton elegantly? I think the most "elegant" is with a metaclass, since I feel like a singleton is not just an ordinary type (and __

Four issue trackers submitted for Infrastructue Committee's tracker search

2006-08-07 Thread Brett Cannon
Back in June, the Python Software Foundation's Infrastructure Committee asked for help in the search for a new issue tracker to replace SourceForge (see http://wiki.python.org/moin/CallForTrackers for details). We asked people who wished to help with the search to install their favourite issue tra

Re: A problem from a Vim user

2006-08-07 Thread BartlebyScrivener
manuhack wrote: > However, when I run > the same command in vim 7 as :py raw_input('Please type something.\n'), > there is an EOFError: EOF when reading a line. Is there a way to use > that command within vim without raising errors? I thought you might get more help here than in comp.editors ;)

Re: email client like mutt

2006-08-07 Thread Aahz
In article <[EMAIL PROTECTED]>, cga2000 <[EMAIL PROTECTED]> wrote: >On Sun, Aug 06, 2006 at 04:15:08PM EDT, Aahz wrote: >> In article <[EMAIL PROTECTED]>, >> Fabian Braennstroem <[EMAIL PROTECTED]> wrote: >>> >>>I am looking for a python email client for the terminal... something like >>>mutt; ma

Re: python - HTML processing - need tips

2006-08-07 Thread Gabriel Genellina
At Monday 7/8/2006 20:58, wipit wrote: I need to process a HTML form in python. I'm using urllib2 and HTMLParser to handle the html. There are several steps I need to take to get to the specific page on the relevant site the first of which is to log in with a username/password. The html code tha

using python at the bash shell?

2006-08-07 Thread John Salerno
Hi all. I just installed Ubuntu and I'm learning how to use the bash shell. Aside from the normal commands you can use, I was wondering if it's possible to use Python from the terminal instead of the normal bash commands (e.g. print instead of echo). My main reason for asking is that I like usi

Import module with non-standard file name

2006-08-07 Thread Ben Finney
Howdy all, Question: I have Python modules named without '.py' as the extension, and I'd like to be able to import them. How can I do that? Background: On Unix, I write programs intended to be run as commands to a file with no extension. This allows other programs to use the command as an interf

Re: using python at the bash shell?

2006-08-07 Thread John McMonagle
On Mon, 2006-08-07 at 21:03 -0400, John Salerno wrote: > Hi all. I just installed Ubuntu and I'm learning how to use the bash > shell. Aside from the normal commands you can use, I was wondering if > it's possible to use Python from the terminal instead of the normal bash > commands (e.g. print

Re: Python open a named pipe == hanging?

2006-08-07 Thread Alex Martelli
Donn Cave <[EMAIL PROTECTED]> wrote: ... > > > I believe your problem is that, by the time you open the > > > pipe for read, it has already been closed by its writer. > > > > Hmmm, no: the problem is, he never opens the pipe for write, because the > > open blocks (will not proceed until somebod

Re: using python at the bash shell?

2006-08-07 Thread skip
John> Aside from the normal commands you can use, I was wondering if John> it's possible to use Python from the terminal instead of the John> normal bash commands (e.g. print instead of echo). Take a look at ipython . It's not precisely what you've asked f

Re: Import module with non-standard file name

2006-08-07 Thread John Machin
Ben Finney wrote: > Howdy all, > > Question: I have Python modules named without '.py' as the extension, > and I'd like to be able to import them. How can I do that? > > Background: > > On Unix, I write programs intended to be run as commands to a file > with no extension. This allows other progra

Re: email client like mutt

2006-08-07 Thread cga2000
On Mon, Aug 07, 2006 at 08:34:16PM EDT, Aahz wrote: > In article <[EMAIL PROTECTED]>, > cga2000 <[EMAIL PROTECTED]> wrote: > >On Sun, Aug 06, 2006 at 04:15:08PM EDT, Aahz wrote: > >> In article <[EMAIL PROTECTED]>, > >> Fabian Braennstroem <[EMAIL PROTECTED]> wrote: > >>> > >>>I am looking for a

Re: Import module with non-standard file name

2006-08-07 Thread Ben Finney
"John Machin" <[EMAIL PROTECTED]> writes: > Ben Finney wrote: > > Now that I've got it written as a Python module, I'd like to write > > unit tests for that module, which of course will need to import > > the program module to test it. The unit test can explicitly add > > the directory where the p

Changing UNIX tty driver keys -- Suggested changes to "termios" module

2006-08-07 Thread Derek Peschel
Should I add an RFE to SourceForge too? I'd like a wide audience in case someone has enough experience to comment or is solving the same problem. I'm using the urwid library which uses curses. On my system (Mac OS 10.3.7) I specifically have ncurses. The programs I'm running turn off echoing an

Re: Import module with non-standard file name

2006-08-07 Thread John Machin
Ben Finney wrote: > "John Machin" <[EMAIL PROTECTED]> writes: > > > Ben Finney wrote: > > > Now that I've got it written as a Python module, I'd like to write > > > unit tests for that module, which of course will need to import > > > the program module to test it. The unit test can explicitly add

Re: Import module with non-standard file name

2006-08-07 Thread John McMonagle
On Tue, 2006-08-08 at 11:06 +1000, Ben Finney wrote: > Howdy all, > > Question: I have Python modules named without '.py' as the extension, > and I'd like to be able to import them. How can I do that? > > Background: > > On Unix, I write programs intended to be run as commands to a file > with n

Re: Import module with non-standard file name

2006-08-07 Thread Ben Finney
"John Machin" <[EMAIL PROTECTED]> writes: > Ben Finney wrote: > > "John Machin" <[EMAIL PROTECTED]> writes: > > > If it can [modify sys.path], it can copy the MUT to some temp > > > directory, adding .py to the end of the name of the new file, > > > and put the temp directory in sys.path can'

Question on try/except

2006-08-07 Thread Dan
While perusing sre.py in the standard library, I came upon this snippet of code in the _compile() function definition: try: p = sre_compile.compile(pattern, flags) except error, v: raise error, v # invalid expression Is there some particular use in catching an excepti

Re: Question on try/except

2006-08-07 Thread Kirk McDonald
Dan wrote: > While perusing sre.py in the standard library, I came upon this snippet > of code in the _compile() function definition: > > try: > p = sre_compile.compile(pattern, flags) > except error, v: > raise error, v # invalid expression > > Is there some particular u

Re: is it possible to dividing up a class in multiple files?

2006-08-07 Thread John McMonagle
On Mon, 2006-08-07 at 15:41 +0200, Martin Höfling wrote: > Hi there, > > is it possible to put the methods of a class in different files? I just > want to order them and try to keep the files small. > Here's how I do it: Firstly, I create a file called imports.py which contains all my import s

Re: is it possible to dividing up a class in multiple files?

2006-08-07 Thread Patrick Maupin
Diez B. Roggisch wrote: > Martin Höfling wrote: > > > is it possible to put the methods of a class in different files? I just > > want to order them and try to keep the files small. > > No, its not possible. What you can do is to create several classes and one > that inherits from all of them. > >

Re: Import module with non-standard file name

2006-08-07 Thread Patrick Maupin
Ben Finney wrote: > Howdy all, > > Question: I have Python modules named without '.py' as the extension, > and I'd like to be able to import them. How can I do that? This is a piece of cake in Python. >>> from types import ModuleType >>> x = ModuleType('myModName') >>> data = open('myfilename').

Re: Question on try/except

2006-08-07 Thread Patrick Maupin
Kirk McDonald wrote: > Dan wrote: > > Is there some particular use in catching an exception and immediately > > re-raising it? Why catch it at all? > > All I can think of is that it changes the traceback to point to the > re-raise and not the original raise. I've used this technique before. It

Re: Import module with non-standard file name

2006-08-07 Thread Simon Forman
Ben Finney wrote: > Howdy all, > > Question: I have Python modules named without '.py' as the extension, > and I'd like to be able to import them. How can I do that? > > Background: > > On Unix, I write programs intended to be run as commands to a file > with no extension. This allows other program

Re: using python at the bash shell?

2006-08-07 Thread Simon Forman
[EMAIL PROTECTED] wrote: > John> Aside from the normal commands you can use, I was wondering if > John> it's possible to use Python from the terminal instead of the > John> normal bash commands (e.g. print instead of echo). > > Take a look at ipython . It's not p

Re: email client like mutt

2006-08-07 Thread Fabian Braennstroem
Hi to both, * cga2000 <[EMAIL PROTECTED]> wrote: > On Mon, Aug 07, 2006 at 08:34:16PM EDT, Aahz wrote: >> In article <[EMAIL PROTECTED]>, >> cga2000 <[EMAIL PROTECTED]> wrote: >> >On Sun, Aug 06, 2006 at 04:15:08PM EDT, Aahz wrote: >> >> In article <[EMAIL PROTECTED]>, >> >> Fabian Braennstroem

Re: access abook addressbook with curses

2006-08-07 Thread Fabian Braennstroem
Hi Ben, * Ben C <[EMAIL PROTECTED]> wrote: > On 2006-08-06, Fabian Braennstroem <[EMAIL PROTECTED]> wrote: >> Hi Ben, >> >> * Ben C <[EMAIL PROTECTED]> wrote: >>> On 2006-08-05, Fabian Braennstroem <[EMAIL PROTECTED]> wrote: Hi, I want to get access to my abook address file with pyt

Re: Static Variables in Python?

2006-08-07 Thread Paddy
Cameron Laird wrote: > In article <[EMAIL PROTECTED]>, > Paddy <[EMAIL PROTECTED]> wrote: > . > [substantial thread > with many serious > alternatives] > . > . > >You can do things with func

import help

2006-08-07 Thread placid
Hi all, How do i import a module that has an hypen/dash (-) in its name ? I get a SytaxError exception Cheers -- http://mail.python.org/mailman/listinfo/python-list

Re: import help

2006-08-07 Thread Gary Herron
placid wrote: > Hi all, > > How do i import a module that has an hypen/dash (-) in its name ? I get > a SytaxError exception > > Cheers > > You can't do that directly. However, the internals of the import mechanism are available to the programmer through a module named imp. It allows you to im

Re: import help

2006-08-07 Thread Rob Wolfe
placid wrote: > Hi all, > > How do i import a module that has an hypen/dash (-) in its name ? I get > a SytaxError exception You can use function __import__. >>> print open("-test.py").read() def fun2(): return "Hello from -test !" >>> import -test File "", line 1 import -test

Re: Import module with non-standard file name

2006-08-07 Thread Ben Finney
"Patrick Maupin" <[EMAIL PROTECTED]> writes: > Ben Finney wrote: > > Question: I have Python modules named without '.py' as the extension, > > and I'd like to be able to import them. How can I do that? > > This is a piece of cake in Python. > > >>> from types import ModuleType > >>> x = ModuleTy

<    1   2