Re: Python 2.6 worth the hassle?

2009-05-06 Thread Christian Heimes
Evan Kroske schrieb: > I'm planning on learning Python, and I'd like to know which version to > start with. I know that Python 3.0 isn't ready for production and it > doesn't have enough libraries yet, so I thought I should learn Python > 2.6. Unfortunately, installing Python 2.6 on my Linux distro

[ANN] BPT (Boxed Package Tool) 0.3

2009-05-06 Thread Giuseppe Ottaviano
Hi all, I am happy to announce BPT 0.3 http://pypi.python.org/pypi/bpt This release solves some important bugs, and the documentation has less TODOs. Version 0.3 === - Improved documentation - Fixed a bug that prevented the ``env`` script to be ``source``\'d (Works only with bash

Re: Threading and GIL

2009-05-06 Thread Carl Banks
On May 6, 5:13 pm, googler.1.webmas...@spamgourmet.com wrote: > Hi! > > I have a big problem I can't solve and I hope anyone of you can help > me. I use the Python C API and in C++ I have a class which represets a > thread object, similiar to the thread class of the known Python Thread > class but

Re: Copy & Paste in a Dos box

2009-05-06 Thread Dave Angel
Mensanator wrote: On May 6, 6:15 pm, MRAB wrote: Mensanator wrote: On May 6, 3:46 pm, Dave Angel wrote: Mensanator wrote: And when prompted, do "(.) modify shortcut that started this window" After which, you can dispense with the menus (except when pasting), just se

Re: Self function

2009-05-06 Thread Rhodri James
On Wed, 06 May 2009 23:33:20 +0100, Luis Alberto Zarrabeitia Gomez wrote: Quoting Rhodri James : So the answer to my question would be "nothing"? Indeed, there is nothing broken with the search and replace feature of his editor. When he is copying a non-recursive function, it is _useles

Re: Python 2.6 worth the hassle?

2009-05-06 Thread Steven D'Aprano
On Wed, 06 May 2009 18:25:48 -0400, Evan Kroske wrote: > I'm planning on learning Python, and I'd like to know which version to > start with. I know that Python 3.0 isn't ready for production and it > doesn't have enough libraries yet, so I thought I should learn Python > 2.6. Unfortunately, insta

Re: Python 2.6 worth the hassle?

2009-05-06 Thread Christian Heimes
Steven D'Aprano wrote: > Are you saying that Intrepid uses Python3.0 as it's default Python? > > If not, then just use the default Python installed. Possibly Python 2.5. > The differences between 2.5 and 2.6 are minor. Ubuntu 9.04 has Python 2.6.2 as default Python interpreter. It's also shipped

Re: Self function

2009-05-06 Thread Steven D'Aprano
On Thu, 07 May 2009 01:59:02 +0100, Rhodri James wrote: > On Wed, 06 May 2009 23:33:20 +0100, Luis Alberto Zarrabeitia Gomez > wrote: > >> Quoting Rhodri James : >>> So the answer to my question would be "nothing"? >> >> Indeed, there is nothing broken with the search and replace feature of >> h

Re: Copy & Paste in a Dos box

2009-05-06 Thread Shawn Milochik
> Damn! I may just go back to using Python from the command prompt > instead of using IDLE. > > On second thought, IDLE is way too useful for indenting, dedenting, > commenting and uncommenting blocks of code. Can't go back to using > Notepad. > You might want to check out iPython, then -- it's

Re: hex(dummy)[2:] - issue...

2009-05-06 Thread Tim Chase
I need some advice :-) I'm using hex(dummy)[2:] to represent a color in hexadecimal format for the bgcolor in an html file. dummy is the color value in RGB of course... Now, if there's an R, G or B value of zero, this command only prints one single 0 instead of two. What's wrong with the code?

Re: removing row from table. PyQT

2009-05-06 Thread MRAB
Ani wrote: I'm trying to remove the selected rows from the table, but it's not working, i've tried many ways, don't know what I'm missing. code below: [snip] def remove(self): print "removendo da tabela" #self.tableWidget.removeRow(self.tableView.selectedIndexes())

[RELEASED] Python 3.1 beta 1

2009-05-06 Thread Benjamin Peterson
On behalf of the Python development team, I'm thrilled to announce the first and only beta release of Python 3.1. Python 3.1 focuses on the stabilization and optimization of features and changes Python 3.0 introduced. For example, the new I/O system has been rewritten in C for speed. File system

Tkinter Caesar Cipher GUI (speed errors?)

2009-05-06 Thread Andrew Free
I have been told the mailing lists talk a lot about Tkinter and I have not been able to find anyone who knows the answer to this question. This is also the first time I have used the mailing lists, so hey guys :D. I decided to work on a GUI for this because I need the practice. However I

Re: list comprehension question

2009-05-06 Thread Steven D'Aprano
On Wed, 06 May 2009 09:48:51 -0400, J Kenneth King wrote: > Emile van Sebille writes: > >> On 5/5/2009 9:15 AM J Kenneth King said... >> >>> List comprehensions can make a reader of your code apprehensive >>> because it can read like a run-on sentence and thus be difficult to >>> parse. The Pyth

Re: Copy & Paste in a Dos box

2009-05-06 Thread Scott David Daniels
Dave Angel wrote: Mensanator wrote: ... After which, you can dispense with the menus (except when pasting), just select the text and hit . To paste into a DOS box, once Quick Edit is enabled, use Right-Click. They keystrokes will be sent to the command editor. Note that the interpretation i

Re: Self function

2009-05-06 Thread Luis Alberto Zarrabeitia Gomez
Quoting Steven D'Aprano : > But regardless, everyone is missing the most important point: why are you > copying and pasting code in the first place? That is surely very close to > the top of the list of Worst Ever Anti-Patterns, and it should be avoided > whenever possible. [btw, I took this

Re: call function of class instance with no assigned name?

2009-05-06 Thread George Oliver
On May 6, 3:07 pm, Carl Banks wrote: > I'm going to guess that you want the keyboardHandler to call method of > commandHandler. There's no reason for commandHandler to be a handler > at all then: keyboardHandler is already handling it. Thanks Carl, you've got it right and your following exampl

Re: Simple way of handling errors

2009-05-06 Thread Steven D'Aprano
On Wed, 06 May 2009 16:40:19 -0700, TomF wrote: > As a relative newcomer to Python, I like it a lot but I'm dismayed at > the difficulty of handling simple errors. In Perl if you want to > anticipate a file-not-found error you can simply do: > > open($file) or die("open($file): $!"); > > and y

Why there is a parameter named "self" for classmethod function?

2009-05-06 Thread Jianchun Zhou
Hi, ALL: I have a sample code as bellow: #!/usr/bin/env python class Hello: def __init__(self): print "Hello __init__" @classmethod def print_hello(self): print "hello" Hello.print_hello() If I move "self" parameter of print_hello away, this code fragment won't work

Re: Why there is a parameter named "self" for classmethod function?

2009-05-06 Thread Chris Rebert
On Wed, May 6, 2009 at 7:49 PM, Jianchun Zhou wrote: > Hi, ALL: > > I have a sample code as bellow: > > #!/usr/bin/env python > > class Hello: >     def __init__(self): >     print "Hello __init__" >     @classmethod >     def print_hello(self): >     print "hello" > > Hello.print_hello()

Re: Why there is a parameter named "self" for classmethod function?

2009-05-06 Thread Kurt Symanzik
Jianchun Zhou wrote on 2009-05-07 10:49:33 AM +0800 I have a sample code as bellow: #!/usr/bin/env python class Hello: def __init__(self): print "Hello __init__" @classmethod def print_hello(self): print "hello" Hello.print_hello() If I move "self" parameter of pr

Re: Could this expression parser be more 'Pythonic'?

2009-05-06 Thread John Machin
On May 7, 9:23 am, Amr wrote: > Hello all, > > I've been spending the last few weeks learning Python, and I've just > started to use it to write a simple BASIC compiler. I'm writing a > mathematical expression parser and wrote a function that would take a > string and split it into high level toke

Re: Simple way of handling errors

2009-05-06 Thread TomF
On 2009-05-06 19:41:29 -0700, Steven D'Aprano said: On Wed, 06 May 2009 16:40:19 -0700, TomF wrote: As a relative newcomer to Python, I like it a lot but I'm dismayed at the difficulty of handling simple errors. In Perl if you want to anticipate a file-not-found error you can simply do: op

Logging exceptions to a file

2009-05-06 Thread Pierre GM
All, I need to log messages to both the console and a given file. I use the following code (on Python 2.5) >>> import logging >>> # >>> logging.basicConfig(level=logging.DEBUG,) >>> logfile = logging.FileHandler('log.log') >>> logfile.setLevel(level=logging.INFO) >>> logging.getLogger('').addHandl

Re: Code works fine except...

2009-05-06 Thread Ross
On May 6, 3:14 pm, John Yeung wrote: > On May 6, 3:29 am, MRAB wrote: > > > I have the feeling that if the number of rounds is restricted then the > > difference between the minimum and maximum number of byes could be 2 > > because of the requirement that players shouldn't play each other more >

Re: Parsing text

2009-05-06 Thread C or L Smith
> Hi, > I'm trying to write a fairly basic text parser to split up scenes and > acts in plays to put them into XML. I've managed to get the text split > into the blocks of scenes and acts and returned correctly but I'm > trying to refine this and get the relevant scene number when the split > is ma

Re: Self function

2009-05-06 Thread Terry Reedy
Steven D'Aprano wrote: I am writing a book (with Python package) on algorithms that has *lots* of recursive functions. I have also discovered that changing names can be a pain. So in the text, (but not code) I have tried the equivalent of # real_name def f(params): ... f(args) (This also

Re: Code works fine except...

2009-05-06 Thread Ross
On May 6, 3:14 pm, John Yeung wrote: > On May 6, 3:29 am, MRAB wrote: > > > I have the feeling that if the number of rounds is restricted then the > > difference between the minimum and maximum number of byes could be 2 > > because of the requirement that players shouldn't play each other more >

Re: Code works fine except...

2009-05-06 Thread Ross
On May 6, 3:14 pm, John Yeung wrote: > On May 6, 3:29 am, MRAB wrote: > > > I have the feeling that if the number of rounds is restricted then the > > difference between the minimum and maximum number of byes could be 2 > > because of the requirement that players shouldn't play each other more >

Re: Why there is a parameter named "self" for classmethod function?

2009-05-06 Thread Terry Reedy
Kurt Symanzik wrote: But you might consider decorating the method as a static method instead since in your example you are not using the parameter at all. A static method would not require a parameter. @staticmethod def print_hello(): print "hello" Functions that refer to neither the

Re: Code works fine except...

2009-05-06 Thread John Yeung
On May 7, 12:30 am, Ross wrote: > > If I were to set up a dictionary that counted players used in the bye > list and only allowed players to be added to the bye list if they were > within 2 of the least used player, would this be a good approach for > managing bye selection or would using a dictio

Re: problem in using sendmail in multi thread

2009-05-06 Thread gganesh
On May 6, 7:10 pm, Jean-Paul Calderone wrote: > On Tue, 5 May 2009 22:17:35 -0700 (PDT), gganesh wrote: > >On May 5, 9:25 pm, Piet van Oostrum wrote: > >> > gganesh (g) wrote: > >> >g> hi, > >> >g> I'm a beginner in using Python script > >> >g> I'm trying to send mails using multi-thread >

Re: Why there is a parameter named "self" for classmethod function?

2009-05-06 Thread Steven D'Aprano
On Thu, 07 May 2009 00:39:28 -0400, Terry Reedy wrote: > Functions that refer to neither the class nor an instance thereof can > usually be moved outside the class altogether. Python is not Java. I > believe staticmethod() was mainly added because it is needed for > .__new__(), at least in some

Re: Logging exceptions to a file

2009-05-06 Thread Lawrence D'Oliveiro
In message <597627b8- d30b-4b74-9202-9cd46fb1d...@s28g2000vbp.googlegroups.com>, Pierre GM wrote: > ... I'd like to record (possibly unhandled) exceptions in the logfile. python myscript.py 2>error.log -- http://mail.python.org/mailman/listinfo/python-list

<    1   2