Re: Exception handling in Python 3.x

2010-12-06 Thread John Nagle
On 12/6/2010 4:23 PM, Steven D'Aprano wrote: On Mon, 06 Dec 2010 13:13:40 -0800, Paul Rubin wrote: It's really unfortunate, though, that Python 3 didn't offer a way to peek at the next element of an iterable and test emptiness directly. This idea of peekable iterables just won't die, despite

Re: Exception handling in Python 3.x

2010-12-06 Thread John Nagle
On 12/6/2010 2:24 PM, Mark Wooding wrote: John Nagle writes: Right. You're not entitled to assume that StopIteration is how a generator exits. That's a CPyton thing; generators were a retrofit, and that's how they were hacked in. Other implementations may do generators differently. This i

Re: Comparison with False - something I don't understand

2010-12-06 Thread Nobody
On Mon, 06 Dec 2010 08:32:18 -0500, Mel wrote: > Apparently, at the end of his research, Alan Turing was trying out the idea > of 'oracles', where a computable process would have access to an > uncomputable process to get particular results. I would imagine that the > idea here was to clarify

Re: TDD in python

2010-12-06 Thread ax003d
This book may help you: http://www.apress.com/book/view/9781590599815 2010/12/7 Chris Withers > On 30/11/2010 13:33, Roy Smith wrote: > >> In article >> <58fe3680-21f5-42f8-9341-e069cbb88...@r19g2000prm.googlegroups.com>, >> rustom wrote: >> >> Looking around I found this: >>> http://bytes.co

Re: A web site using Python

2010-12-06 Thread Gerry Reno
If you have any need of a portable LAMP stack, I just finished writing some How-To's for getting Python, VirtualEnv and WSGI frameworks running with XAMPP: How-To: Add VirtualEnv and Pylons (WSGI framework) to XAMPP How-To: Add VirtualEn

Re: A web site using Python

2010-12-06 Thread Hidura
KarinApp will allow you to create an application without writing code, eg: you want to insert the information of a person in the DB, with all the current framework you will write a code that takes the data, and after you will write the insert, and if you want to send a response you will have to wri

Re: Exception handling in Python 3.x

2010-12-06 Thread MRAB
On 07/12/2010 00:23, Steven D'Aprano wrote: On Mon, 06 Dec 2010 13:13:40 -0800, Paul Rubin wrote: It's really unfortunate, though, that Python 3 didn't offer a way to peek at the next element of an iterable and test emptiness directly. This idea of peekable iterables just won't die, despite t

Re: A web site using Python

2010-12-06 Thread Alice Bevan–McGregor
1. Pick a web framework, I'd suggest looking at: Django (http://www.djangoproject.com/) Pyramid (http://docs.pylonshq.com/pyramid/dev/) I'm biased, but I can highly recommend WebCore (http://www.web-core.org/) as it more easily supports small to mid-sized applications and actively enco

Re: Exception handling in Python 3.x

2010-12-06 Thread Steven D'Aprano
On Mon, 06 Dec 2010 13:13:40 -0800, Paul Rubin wrote: > It's really unfortunate, though, that Python 3 didn't offer a way to > peek at the next element of an iterable and test emptiness directly. This idea of peekable iterables just won't die, despite the obvious flaws in the idea. There's no g

Re: Comparisons of incompatible types

2010-12-06 Thread Steven D'Aprano
On Mon, 06 Dec 2010 08:59:12 -0800, TomF wrote: > I'm aggravated by this behavior in python: > > x = "4" > print x < 7# prints False > I can't imagine why this design decision was made. You've never needed to deal with an heterogeneous list? data = ["Fred", "Barney", 2, 1, None] data.sort

Re: A web site using Python

2010-12-06 Thread Stef Mientki
On 04-12-2010 15:54, hid...@gmail.com wrote: > I am working on a tool that can create an application like that without write > server code, but the > system is write in Python3.1 very interesting, could you give us some more information about the project for the OP: with web2py, your site could

JSONBOT 0.5 RELEASED

2010-12-06 Thread Bart Thate
Hello world ;] I'm back with another release of JSONBOT, this time it is version 0.5 so we are half way through making this a 1.0 release. Lot of changes to the core as well as other bug fixes, let me sum it up: * this version requires an upgrade of your 0.4 JSONBOT if you run already a JSONBOT s

Re: Comparison with False - something I don't understand

2010-12-06 Thread Mark Wooding
Carl Banks writes: > On Dec 6, 12:58 pm, m...@distorted.org.uk (Mark Wooding) wrote: > >         def toy(x, y): > >           r = restart('use-value') > >           with r: > >             if y == 0: > >               error(ZeroDivisionError()) > >             r.result = x/y > >           return

Task Engine Framework?

2010-12-06 Thread Nate
Hello, I'm in the process of developing a task engine / workflow module for my Python application and I'm wondering if anyone knows of existing code that could be used or adapted. Since I know that's far too generic a question, let me share my goals: 1) Support long running operations (think back

Re: A web site using Python

2010-12-06 Thread Chris Withers
On 04/12/2010 13:32, Virgil Stokes wrote: *How, armed with Python 2.6 (or 2.7) and all of the Python packages available, should I attack the problem of getting this web site up and running on a Windows platform?* 1. Pick a web framework, I'd suggest looking at: Django (http://www.djangoproje

Re: Python assignments

2010-12-06 Thread Chris Withers
Try here: http://www.python.org/community/jobs/ Chris On 03/12/2010 13:50, Sverker Nilsson wrote: Dear friends, This is Sverker from Sweden. You probably know me better as the guy who made Guppy/Heapy: http://guppy-pe.sf.net I am currently in the process of preparing version 0.1.10 with sup

Re: Comparison with False - something I don't understand

2010-12-06 Thread Carl Banks
On Dec 6, 2:42 pm, Carl Banks wrote: > Or, you could just put your try...finally inside a loop. er, try...except Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Comparison with False - something I don't understand

2010-12-06 Thread Carl Banks
On Dec 6, 12:58 pm, m...@distorted.org.uk (Mark Wooding) wrote: > Paul Rubin writes: > > You know, I've heard the story from language designers several times > > over, that they tried putting resumable exceptions into their languages > > and it turned out to be a big mess, so they went to terminat

Re: TDD in python

2010-12-06 Thread Chris Withers
On 30/11/2010 13:33, Roy Smith wrote: In article <58fe3680-21f5-42f8-9341-e069cbb88...@r19g2000prm.googlegroups.com>, rustom wrote: Looking around I found this: http://bytes.com/topic/python/answers/43330-unittest-vs-py-test where Raymond Hettinger no less says quite unequivocally that he pr

Re: Exception handling in Python 3.x

2010-12-06 Thread Mark Wooding
John Nagle writes: > Right. You're not entitled to assume that StopIteration is how a > generator exits. That's a CPyton thing; generators were a retrofit, > and that's how they were hacked in. Other implementations may do > generators differently. This is simply wrong. The StopIteration exc

[RELEASED] Python 3.2 beta 1

2010-12-06 Thread Georg Brandl
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On behalf of the Python development team, I'm happy to announce the first of two beta preview releases of Python 3.2. Python 3.2 is a continuation of the efforts to improve and stabilize the Python 3.x line. Since the final release of Python 2.7, the

Re: Comparisons of incompatible types

2010-12-06 Thread Mark Wooding
Terry Reedy writes: > And indeed, code like this that has not been updated does break in > 3.x. to some people's annoyance. We really really cannot please > everyone ;-). The problem is that there are too many useful properties that one might expect from comparison operators. For example, it's

Re: Resumable exceptions bad:

2010-12-06 Thread Mark Wooding
John Nagle writes: > Resumable exceptions were a popular idea in the early days of > programming. LISP, PL/I, and early COBOL had constructs which could > be considered resumable exceptions. They didn't work out well, > because the exception handler gets control in an ambiguous situation, > per

Re: Exception handling in Python 3.x

2010-12-06 Thread Paul Rubin
Steven D'Aprano writes: > Apart from this horrible idiom: > > def func(iterable): > it = iter(iterable) > failed = False > try: > x = next(it) > except StopIteration: > failed = True > if failed: > raise ValueError("can't process empty iterable") > p

Re: Comparison with False - something I don't understand

2010-12-06 Thread Mark Wooding
Paul Rubin writes: > You know, I've heard the story from language designers several times > over, that they tried putting resumable exceptions into their languages > and it turned out to be a big mess, so they went to termination > exceptions that fixed the issue. That seems very surprising to m

Re: Exception handling in Python 3.x

2010-12-06 Thread John Nagle
On 12/3/2010 5:04 AM, Steven D'Aprano wrote: Consider the following common exception handling idiom: def func(iterable): it = iter(iterable) try: x = next(it) except StopIteration: raise ValueError("can't process empty iterable") print(x) The intention is:

Re: PEP8 compliance and exception messages ?

2010-12-06 Thread Andreas Waldenburger
On Mon, 6 Dec 2010 00:22:49 -0500 Andreas Waldenburger wrote: > On Sun, 5 Dec 2010 19:52:54 -0800 Chris Rebert > wrote: > > > On Sun, Dec 5, 2010 at 7:40 PM, shearichard > > wrote: > > > Hi - PEP8 says lines should not exceed 79 characters in length > > > ( http://www.python.org/dev/peps/pep-

announcing pyutil-1.8.0

2010-12-06 Thread Zooko O'Whielacronx
Folks: pyutil is a collection of modules and functions that we've found useful over the years. Peter Westlake and Ravi Pinjala (who found pyutil through the Tahoe-LAFS project) contributed some documentation about what each module in pyutil does, and SimpleGeo (my employer) is using one small par

Re: Comparisons of incompatible types

2010-12-06 Thread Terry Reedy
On 12/6/2010 12:46 PM, Robert Kern wrote: On 12/6/10 11:16 AM, TomF wrote: Given that the semantics are virtually random, how could code depend on this? There are cases where you don't particularly care *what* order is given as long as it is consistent. Let's say you want to make sure that t

Resumable exceptions bad: (was Re: Comparison with False - something I don't understand)

2010-12-06 Thread John Nagle
On 12/6/2010 12:40 AM, Steve Holden wrote: On 12/6/2010 9:14 AM, Paul Rubin wrote: m...@distorted.org.uk (Mark Wooding) writes: The most obvious improvement is resumable exceptions. You know, I've heard the story from language designers several times over, that they tried putting resumable ex

Re: Perceived inconsistency in py3k documentation

2010-12-06 Thread Antoine Pitrou
On Sun, 05 Dec 2010 14:47:38 -0500 Terry Reedy wrote: > On 12/5/2010 3:31 AM, Greg wrote: > > For future reference, > > > 1) At http://docs.python.org/py3k/reference/datamodel.html: > > 2) At http://docs.python.org/py3k/library/stdtypes.html: > > do not work because of the trailing :s, at least

Re: Comparison with False - something I don't understand

2010-12-06 Thread Martin Gregorie
On Mon, 06 Dec 2010 09:54:46 -0800, Dennis Lee Bieber wrote: > On Mon, 06 Dec 2010 00:14:11 -0800, Paul Rubin > declaimed the following in gmane.comp.python.general: > > >> exceptions that fixed the issue. Are there any languages out there >> with resumable exceptions? Escaping to a debugger

Re: Comparison with False - something I don't understand

2010-12-06 Thread John Nagle
On 12/2/2010 10:09 AM, Paul Rubin wrote: MRAB writes: When writing the C code for the new regex module I thought that it would've been easier if I could've used exceptions to propagate errors and unwind the stack, instead of having to return an error code which had to be checked by the caller,

Re: Which non SQL Database ?

2010-12-06 Thread CM
> You're also confusing MB/s (bytes) with Mb/s (bits). Yes I am. I think I will now recuse myself from the proceedings... -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie needs regex help

2010-12-06 Thread Dan M
On Mon, 06 Dec 2010 18:12:33 +0100, Peter Otten wrote: > By the way: > print quopri.decodestring("=E4=F6=FC").decode("iso-8859-1") > äöü print r"\xe4\xf6\xfc".decode("string-escape").decode("iso-8859-1") > äöü Ah - better than a regex. Thanks! -- http://mail.python.org/mailman/listin

Re: Passing Variable(s) as kwargs

2010-12-06 Thread BJ Swope
> > It's complaining that the 'minute' argument which you're passing to > 'add_cron_job' is '*/run_interval_quantity', which the scheduler > doesn't understand. > -- > Hey, what do you know, there's a forest amongst all those trees... key_words = '*/%d' % (run_interval_quantity) sched.add_cron_j

Re: Comparisons of incompatible types

2010-12-06 Thread Robert Kern
On 12/6/10 11:16 AM, TomF wrote: On 2010-12-06 09:04:00 -0800, Peter Otten said: This change would break a lot of code, so it could not be made within the 2.x series. However: Python 3.1.1+ (r311:74480, Nov 2 2009, 15:45:00) [GCC 4.4.1] on linux2 Type "help", "copyright", "credits" or "licen

Re: Which non SQL Database ?

2010-12-06 Thread Dave Angel
On 01/-10/-28163 02:59 PM, CM wrote: On Dec 6, 2:17 am, Steve Holden wrote: Just as a matter of interest where do you get the information that the average user has a 3.9 MB/s path to the Internet? First, I should have specified the average *U.S.* user, and in so doing realized how dumbly "o

Re: Passing Variable(s) as kwargs

2010-12-06 Thread MRAB
On 06/12/2010 16:40, BJ Swope wrote: Hello All. I am trying to use values, retrieved from a config file, as kwargs and not having any luck. Well at least I think that's what I'm trying to do ;) Any suggestions would be most appreciated. Here's the exception: Traceback (most recent call last)

Re: Comparisons of incompatible types

2010-12-06 Thread TomF
On 2010-12-06 09:04:00 -0800, Peter Otten said: TomF wrote: I'm aggravated by this behavior in python: x = "4" print x < 7# prints False The issue, of course, is comparisons of incompatible types. In most languages this throws an error (in Perl the types are converted silently). In P

Re: Newbie needs regex help

2010-12-06 Thread Peter Otten
Dan M wrote: > I'm getting bogged down with backslash escaping. > > I have some text files containing characters with the 8th bit set. These > characters are encoded one of two ways: either "=hh" or "\xhh", where "h" > represents a hex digit, and "\x" is a literal backslash followed by a > lower-

Re: Which non SQL Database ?

2010-12-06 Thread MRAB
On 06/12/2010 16:35, CM wrote: On Dec 6, 2:17 am, Steve Holden wrote: On 12/5/2010 12:59 AM, CM wrote: SQlite itself is around 300 kilobytes. That's negligible. It is also already in Python, so you'd have to purposefully exclude it in creating your executable to save those 300 kb and thus t

Re: Comparisons of incompatible types

2010-12-06 Thread Peter Otten
TomF wrote: > I'm aggravated by this behavior in python: > > x = "4" > print x < 7# prints False > > The issue, of course, is comparisons of incompatible types. In most > languages this throws an error (in Perl the types are converted > silently). In Python this comparison fails silently.

Re: Newbie needs regex help

2010-12-06 Thread Dan M
On Mon, 06 Dec 2010 09:44:39 -0600, Dan M wrote: > That's what I had initially assumed was the case, but looking at the > data files with a hex editor showed me that I do indeed have > four-character sequences. That's what makes this such as interesting > task! Sorry, I misunderstood the first ti

Re: Comparisons of incompatible types

2010-12-06 Thread Tim Golden
On 06/12/2010 16:59, TomF wrote: I'm aggravated by this behavior in python: x = "4" print x < 7 # prints False The issue, of course, is comparisons of incompatible types. In most languages this throws an error (in Perl the types are converted silently). In Python this comparison fails silently.

Comparisons of incompatible types

2010-12-06 Thread TomF
I'm aggravated by this behavior in python: x = "4" print x < 7# prints False The issue, of course, is comparisons of incompatible types. In most languages this throws an error (in Perl the types are converted silently). In Python this comparison fails silently. The documentation says:

Passing Variable(s) as kwargs

2010-12-06 Thread BJ Swope
Hello All. I am trying to use values, retrieved from a config file, as kwargs and not having any luck. Well at least I think that's what I'm trying to do ;) Any suggestions would be most appreciated. Here's the exception: Traceback (most recent call last): File "c:\dev\LogServerMonitor\LogSe

Re: Which non SQL Database ?

2010-12-06 Thread CM
On Dec 6, 2:17 am, Steve Holden wrote: > On 12/5/2010 12:59 AM, CM wrote: > > > SQlite itself is around 300 kilobytes.  That's negligible.  It is also > > already in Python, so you'd have to purposefully exclude it in > > creating your executable to save those 300 kb and thus the 1/13th of a > > s

hay... this is kate, we r staying near by u, wanna dating with me...

2010-12-06 Thread kate for free dating
hay... this is kate, we r staying near by u, wanna dating with me... http://x2c.eu/57 http://x2c.eu/57 http://x2c.eu/57 http://x2c.eu/57 -- http://mail.python.org/mailman/listinfo/python-list

SQLObject 0.15.0

2010-12-06 Thread Oleg Broytman
Hello! I'm pleased to announce version 0.15.0, the first stable release of branch 0.15 of SQLObject. What is SQLObject = SQLObject is an object-relational mapper. Your database tables are described as classes, and rows are instances of those classes. SQLObject is meant to be e

Re: Newbie needs regex help

2010-12-06 Thread Dan M
On Mon, 06 Dec 2010 16:34:56 +0100, Alain Ketterlin wrote: > Dan M writes: > >> I took at look at http://docs.python.org/howto/regex.html, especially >> the section titled "The Backslash Plague". I started out trying : > > import re > r = re.compile('x([0-9a-fA-F]{2})') a = "This \x

Re: Newbie needs regex help

2010-12-06 Thread Dan M
On Mon, 06 Dec 2010 10:29:41 -0500, Mel wrote: > What you're missing is that string `a` doesn't actually contain four- > character sequences like '\', 'x', 'a', 'a' . It contains single > characters that you encode in string literals as '\xaa' and so on. You > might do better with > > p1 = r'([

RCX using python serial help

2010-12-06 Thread Astan Chee
Hi, I've got a lego mindstorm RCX 1.0 (but firmware is 2.0) that uses one of those old serial IR towers to control the microcontroller. I've had a look around at python's serial documentation as well as the RCX's documentation and I'm trying to write something to control the RCX directly using pyth

Re: Newbie needs regex help

2010-12-06 Thread Alain Ketterlin
Dan M writes: > I took at look at http://docs.python.org/howto/regex.html, especially the > section titled "The Backslash Plague". I started out trying : import re r = re.compile('x([0-9a-fA-F]{2})') a = "This \xef file \xef has \x20 a bunch \xa0 of \xb0 crap \xc0 The backs

Re: Newbie needs regex help

2010-12-06 Thread Mel
Dan M wrote: > I'm getting bogged down with backslash escaping. > > I have some text files containing characters with the 8th bit set. These > characters are encoded one of two ways: either "=hh" or "\xhh", where "h" > represents a hex digit, and "\x" is a literal backslash followed by a > lower-

Re: is it possible to see if a class has a decorator ?

2010-12-06 Thread Stef Mientki
On 06-12-2010 16:04, Jean-Michel Pichavant wrote: > Stef Mientki wrote: >> On 06-12-2010 12:08, Ben Finney wrote: >>> Stef Mientki writes: >>> >>> I would like to know if a class definition has a decorator, >>> I'm not sure what this question means. >>> >>> Applying a decorato

Anushka Hot still More

2010-12-06 Thread Raksha R
http://dattinggirls.hpage.us/linklist_75279.html -- http://mail.python.org/mailman/listinfo/python-list

Newbie needs regex help

2010-12-06 Thread Dan M
I'm getting bogged down with backslash escaping. I have some text files containing characters with the 8th bit set. These characters are encoded one of two ways: either "=hh" or "\xhh", where "h" represents a hex digit, and "\x" is a literal backslash followed by a lower-case x. Catching the f

Re: is it possible to see if a class has a decorator ?

2010-12-06 Thread Jean-Michel Pichavant
Stef Mientki wrote: On 06-12-2010 12:08, Ben Finney wrote: Stef Mientki writes: I would like to know if a class definition has a decorator, I'm not sure what this question means. Applying a decorator to a class definition produces a normal class. Classes don't “have” decorators

Re: [ANN] Pyclewn: Vim as a front end to pdb

2010-12-06 Thread Jean-Michel Pichavant
Xavier de Gaye wrote: Pyclewn 1.5 has been released at http://pyclewn.sourceforge.net/ Pyclewn is a python program that allows the use of Vim as a front end to gdb and pdb. This release adds support for ``pdb``, the python debugger. + A python script may be run under the control of ``pdb``. F

Re: Comparison with False - something I don't understand

2010-12-06 Thread Mel
Paul Rubin wrote: > m...@distorted.org.uk (Mark Wooding) writes: >> The most obvious improvement is resumable exceptions. > > You know, I've heard the story from language designers several times > over, that they tried putting resumable exceptions into their languages > and it turned out to be a

Re: simple threading.Thread and Semaphores hang

2010-12-06 Thread Alain Ketterlin
lnenov writes: > My application hangs on exit. > I have isoleted this piece of code that reproduces the error: (the > time module is extra and not needed to reproduce) > > import threading > import time > > def func(): > b = threading.Semaphore(value=0) > b.acquire() This waits for the s

Re: Wanted: slow regexes

2010-12-06 Thread Tim Chase
On 12/05/2010 10:08 PM, MRAB wrote: I'm looking for examples of regexes which are slow (especially those which seem never to finish) but whose results are known. I already have those reported in the bug tracker, but further ones will be welcome. This is for testing additional modifications to th

simple threading.Thread and Semaphores hang

2010-12-06 Thread lnenov
Hi, My application hangs on exit. I have isoleted this piece of code that reproduces the error: (the time module is extra and not needed to reproduce) import threading import time def func(): b = threading.Semaphore(value=0) b.acquire() a = threading.Thread(target=func) a.start() ti

Re: Comparison with False - something I don't understand

2010-12-06 Thread Lie Ryan
On 12/05/10 15:52, Tim Harig wrote: > On 2010-12-05, Tim Harig wrote: >> Another, questionable but useful use, is to ignore the complex accounting >> of your position inside of a complex data structure. You can continue >> moving through the structure until an exception is raised indicating >> th

Re: is it possible to see if a class has a decorator ?

2010-12-06 Thread Steven D'Aprano
On Mon, 06 Dec 2010 22:08:33 +1100, Ben Finney wrote: > Stef Mientki writes: > >> I would like to know if a class definition has a decorator, > > I'm not sure what this question means. > > Applying a decorator to a class definition produces a normal class. > > Classes don't “have” decorators;

Re: is it possible to see if a class has a decorator ?

2010-12-06 Thread Stef Mientki
On 06-12-2010 12:08, Ben Finney wrote: > Stef Mientki writes: > >> I would like to know if a class definition has a decorator, > I'm not sure what this question means. > > Applying a decorator to a class definition produces a normal class. > > Classes don't “have” decorators; classes can be return

Re: is it possible to see if a class has a decorator ?

2010-12-06 Thread Ben Finney
Stef Mientki writes: > I would like to know if a class definition has a decorator, I'm not sure what this question means. Applying a decorator to a class definition produces a normal class. Classes don't “have” decorators; classes can be returned by a decorator function, but AFAIK the resultin

is it possible to see if a class has a decorator ?

2010-12-06 Thread Stef Mientki
hello, I would like to know if a class definition has a decorator, is that possible ? And if so, is it possible to determine the name of these decorator(s) ? thanks, Stef Mientki -- http://mail.python.org/mailman/listinfo/python-list

Re: Which non SQL Database ?

2010-12-06 Thread drygal
On Dec 4, 10:42 pm, Jorge Biquez wrote: > Hello all. > > Newbie question. Sorry. > > As part of my process to learn python I am working on two personal > applications. Both will do it fine with a simple structure of data > stored in files. I now there are lot of databases around I can use > but I

Re: Comparison with False - something I don't understand

2010-12-06 Thread Steve Holden
On 12/6/2010 9:14 AM, Paul Rubin wrote: > m...@distorted.org.uk (Mark Wooding) writes: >> The most obvious improvement is resumable exceptions. > > You know, I've heard the story from language designers several times > over, that they tried putting resumable exceptions into their languages > and i

Re: Comparison with False - something I don't understand

2010-12-06 Thread Paul Rubin
m...@distorted.org.uk (Mark Wooding) writes: > The most obvious improvement is resumable exceptions. You know, I've heard the story from language designers several times over, that they tried putting resumable exceptions into their languages and it turned out to be a big mess, so they went to term