SQLObject 0.11.6

2010-05-06 Thread Oleg Broytman
Hello! I'm pleased to announce version 0.11.6, a minor bugfix release of 0.11 branch 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

SQLObject 0.12.4

2010-05-06 Thread Oleg Broytman
Hello! I'm pleased to announce version 0.12.4, a minor bugfix release of branch 0.12 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

pytest-xdist 1.2: distributed testing getting stable

2010-05-06 Thread holger krekel
pytest-xdist 1.2 brings bug fixes and improved stability for distributed testing with py.test. This plugin allows to ad-hoc distribute test runs to multiple CPUs, different Python interpreters or remote machines. It requires setuptools or distribute which help to pull in the neccessary execnet

SciPy 2010: Bioinformatic Parallel/cloud talks announced... register now!

2010-05-06 Thread Amenity Applewhite
Hello! Things are moving quickly in preparation for SciPy 2010: Last week we announced the General Conference schedule (http://conference.scipy.org/scipy2010/schedule.html ), Tuesday we announced our student sponsorship recipients (http://conference.scipy.org/scipy2010/student.html ) and now

Pydev 1.5.7 Released

2010-05-06 Thread Fabio Zadrozny
Hi All, Pydev 1.5.7 has been released Details on Pydev: http://pydev.org Details on its development: http://pydev.blogspot.com Release Highlights: --- * **Uniquely identifying editors:** * Names are never duplicated * Special treatment for __init__ *

Re: strange interaction between open and cwd

2010-05-06 Thread Cameron Simpson
On 06May2010 05:24, Nobody nob...@nowhere.com wrote: | On Thu, 06 May 2010 10:21:45 +1000, Cameron Simpson wrote: | | Look at the st_rdev field (== the device holding this inode). | When that changes, you've crossed a mount mount point. | | st_dev reports the device on which the inode resides.

Re: long int computations

2010-05-06 Thread Paul Rubin
s...@sig.for.address (Victor Eijkhout) writes: I have two long ints, both too long to convert to float, but their ratio is something reasonable. How can I compute that? The obvious (1.*x)/y does not work. The math.log function has a special hack for long ints, that might help: Python

Re: Sharing a program I wrote

2010-05-06 Thread Paul Rubin
Scott scott.freem...@gmail.com writes: I've seen pypi. It seems to index code that is posted on all sorts of sites - including pypi itself? And what is a package anyway? I've seen sourceforge. It looks like a good home for big applications or multi-developer projects. Freshmeat? Google code?

Re: condition and True or False

2010-05-06 Thread Lawrence D'Oliveiro
In message 685761fe-b052-4d89-92d3-17d1f2a39...@p2g2000yqh.googlegroups.com, Paul McGuire wrote: While sifting through some code looking for old x and y or z code that might better be coded using y if x else z, I came across this puzzler: x = boolean expression and True or False I

Re: modifying open office spreadsheet (with OO installed)

2010-05-06 Thread News123
Hi CHris, Chris Withers wrote: Jim Byrnes wrote: News123 wrote: Mumbling to myself, perhaps somebody else is interested. Yes I am. News123 wrote: Hi, I wanted to know who can recommend a good module/library, that allows to modify an Open Office spreadsheet. One can assume, that

Re: ooolib, reading writing a spread sheet and keep formatting

2010-05-06 Thread News123
Hi Chris, Chris Withers wrote: News123 wrote: Hi Chris, Chris Withers wrote: News123 wrote: from xlrd import open_workbook from xlutils.copy import copy rb = open_workbook('doc1.xls') open_workbook('doc1.xls',formatting_info=True) I'll try, but the doc mentioned explicitely, that

pysms

2010-05-06 Thread luca72
Hello Has anyone used pysms can you tell me with wich gsm module it works? Thanks Luca -- http://mail.python.org/mailman/listinfo/python-list

Re: Parser

2010-05-06 Thread Andreas Löscher
Am Sonntag, den 02.05.2010, 21:54 +0200 schrieb Andreas Löscher: Hi, I am looking for an easy to use parser. I am want to get an overview over parsing and want to try to get some information out of a C-Header file. Which parser would you recommend? Best, Andreas Thanks for your answers.

Re: py3 tkinter acceps bytes. why?

2010-05-06 Thread Matthias Kievernagel
Me: I asked what kinds of bytes are accepted as tkinter parameters. I still wonder why they are accepted at all. Does anyone know a reason for this or has a link to some relevant discussion? Terry Reedy: I do not remember any particular public discussion of tkinter on the dev lists. I

Re: long int computations

2010-05-06 Thread Mark Dickinson
On May 3, 9:49 pm, s...@sig.for.address (Victor Eijkhout) wrote: Jerry Hill malaclyp...@gmail.com wrote: from __future__ import division long1/long2 0.5 Beautiful. Thanks so much guys. And if for some reason you don't want to use the 'from __future__' import, then you can do

ctypes:Multiple library access problem

2010-05-06 Thread Massi
Hi everyone, in my script I need to execute multiple separated loading of the same dll library, in order to handle the internal variables with different threads. Consider the followin piece of code: lib1 = cdll.LoadLibrary(MyLib.dll)) lib2 = cdll.LoadLibrary(MyLib.dll)) lib1.var1 = 0 lib2.var1

column selection

2010-05-06 Thread mannu jha
Hi, I have few files like this: 24 ALA helix (helix_alpha, helix2) 27 ALA helix (helix_alpha, helix2) 51 ALA helix (helix_alpha, helix4) 58 ALA helix (helix_alpha, helix5) 63 ALA helix (helix_alpha, helix5) now with this program: for line in open('1.txt'): columns =

Python - MySQL fetching values

2010-05-06 Thread Kurian Thayil
Hi All, I am pretty new to python, and I have an issue with fetching values in python using MySQLdb module. The query executed is *SELECT TIME(DATE_ADD(info_last_calltime, INTERVAL %s MINUTE)) FROM rem_call_info WHERE info_ctrlid=%s, (retryinterval,controlid1,)* where retryinterval=30 and

Re: column selection

2010-05-06 Thread Xavier Ho
You need to ignore empty lines. for line in open('1.txt'): if len(line.strip()) == 0: continue columns = line.split() print columns[0], columns[2] Cheers, Xav On Thu, May 6, 2010 at 6:22 PM, mannu jha mannu_0...@rediffmail.com wrote: Hi, I have few files like this: 24

Re: Where is python31.dll?

2010-05-06 Thread Dave Angel
Pietro Campesato wrote: Your windows search command? Which is how I verified the above. I looked at the folder visually. Simply using os.listdir shows there is in fact a python31.dll there: somehow it was an invisible file. This is strange since I've never touched any system folder.

Re: Windows7 run python script / sub process with elevated privileges

2010-05-06 Thread Tim Golden
On 01/05/2010 15:44, News123 wrote: Hi, I have a small python script, which has been started as normal non privileged user. At a later point in time it would like to start another python script with elevated privileges. How can I write my code such, that I will get the privilege elevation

Re: Python - MySQL fetching values

2010-05-06 Thread Chris Rebert
On Thu, May 6, 2010 at 1:47 AM, Kurian Thayil kurianmtha...@gmail.com wrote: snip the expected output is 05:35:05. Now, here is code snippet,     cursor1=getconnect1.cursor()     getrows=cursor1.execute(SELECT TIME(DATE_ADD(info_last_calltime, INTERVAL %s MINUTE))

Re: ctypes:Multiple library access problem

2010-05-06 Thread Dave Angel
Massi wrote: Hi everyone, in my script I need to execute multiple separated loading of the same dll library, in order to handle the internal variables with different threads. Consider the followin piece of code: lib1 = cdll.LoadLibrary(MyLib.dll)) lib2 = cdll.LoadLibrary(MyLib.dll)) lib1.var1

Classes: nested functions vs. private methodes

2010-05-06 Thread Richard Lamboj
Hello, what should i take: - nested functions: class MyClass(object) def blah(self): def blub(var1, var2): do something... blub(1, 5) or class MyClass(object) def blah(self): def _blub(var1, var2): do something... _blub(1, 5) - private functions: class

Re: column selection

2010-05-06 Thread Dave Angel
mannu jha wrote: Hi, I have few files like this: 24 ALA helix (helix_alpha, helix2) 27 ALA helix (helix_alpha, helix2) 51 ALA helix (helix_alpha, helix4) 58 ALA helix (helix_alpha, helix5) 63 ALA helix (helix_alpha, helix5) now with this program: for line in open('1.txt'):

Re: long int computations

2010-05-06 Thread Duncan Booth
Peter Otten __pete...@web.de wrote: Victor Eijkhout wrote: I have two long ints, both too long to convert to float, but their ratio is something reasonable. How can I compute that? The obvious (1.*x)/y does not work. import fractions x = 12345 * 10**1000 y = 765 * 10**1000 float(x)

running .py files on Linux

2010-05-06 Thread Tingting HAN
Dear Officer, I want to run two .py files to generate .h5 files. hantingt...@tityro:~$ python2.5 Python 2.5.4 (r254:67916, Jan 20 2010, 21:43:02) [GCC 4.4.1] on linux2 Type help, copyright, credits or license for more information. When ruuning gentest_sphere.py, the problem is as following:

Re: Classes: nested functions vs. private methodes

2010-05-06 Thread Steven D'Aprano
On Thu, 06 May 2010 11:24:49 +0200, Richard Lamboj wrote: Hello, what should i take: - nested functions: class MyClass(object) def blah(self): def blub(var1, var2): do something... blub(1, 5) The disadvantage of nested functions is that it is harder to test them in

RE: ctypes:Multiple library access problem

2010-05-06 Thread Stefan Schukat
Massi wrote: Hi everyone, in my script I need to execute multiple separated loading of the same dll library, in order to handle the internal variables with different threads. Consider the followin piece of code: lib1 = cdll.LoadLibrary(MyLib.dll)) lib2 =

Re: pysms

2010-05-06 Thread jon vs. python
Hi Luca, I've never used pysms, but I just downloaded the source code and it seems that SMS related functionallity is performed using standard GSM AT commands. So if you're accessing the gsm module through a serial port you shouldn't worry at all. Hope it helps, Jon. On Thu, May 6, 2010 at 9:40

Re: Classes: nested functions vs. private methodes

2010-05-06 Thread Richard Lamboj
Am Thursday 06 May 2010 12:02:47 schrieb Steven D'Aprano: On Thu, 06 May 2010 11:24:49 +0200, Richard Lamboj wrote: Hello, what should i take: - nested functions: class MyClass(object) def blah(self): def blub(var1, var2): do something... blub(1, 5) The

Compression module APIs

2010-05-06 Thread Florian Weimer
As far as I can see, the compression-related APIs (gzip, zlib, bzip2) in Python 2.5 have three distinct APIs. Is there really no unified interface, or am I missing something? -- http://mail.python.org/mailman/listinfo/python-list

Re: Compression module APIs

2010-05-06 Thread Chris Rebert
On Thu, May 6, 2010 at 4:09 AM, Florian Weimer f...@deneb.enyo.de wrote: As far as I can see, the compression-related APIs (gzip, zlib, bzip2) in Python 2.5 have three distinct APIs.  Is there really no unified interface, or am I missing something? bz2.BZ2File and gzip.GzipFile both offer a

Re: Compression module APIs

2010-05-06 Thread Florian Weimer
* Chris Rebert: On Thu, May 6, 2010 at 4:09 AM, Florian Weimer f...@deneb.enyo.de wrote: As far as I can see, the compression-related APIs (gzip, zlib, bzip2) in Python 2.5 have three distinct APIs.  Is there really no unified interface, or am I missing something? bz2.BZ2File and

Re: Compression module APIs

2010-05-06 Thread Chris Rebert
On Thu, May 6, 2010 at 4:41 AM, Florian Weimer f...@deneb.enyo.de wrote: * Chris Rebert: On Thu, May 6, 2010 at 4:09 AM, Florian Weimer f...@deneb.enyo.de wrote: As far as I can see, the compression-related APIs (gzip, zlib, bzip2) in Python 2.5 have three distinct APIs.  Is there really no

crash in Py_EnterRecursiveCall

2010-05-06 Thread René J . V . Bertin
Hello, I have embedded Python into and extended it with functionality from a graphical tool I use. One of the things it allows me to do is to export Python objects to a simple scripting language (ascanf), and call them as if they were native functions. I have the following situation in which I

Re: Re: column selection

2010-05-06 Thread mannu jha
I tried with this: for line in open('1.txt'): columns = line.split() print columns[0], columns[1] if not line: continue but it is showing error: nmru...@caf:~ python split.py 24 ALA Traceback (most recent call last): File split.py, line 3, in print columns[0],

Re: running .py files on Linux

2010-05-06 Thread Laszlo Nagy
Tingting HAN írta: Dear Officer, I want to run two .py files to generate .h5 files. hantingt...@tityro:~$ mailto:hantingt...@tityro:%7E$ python2.5 Python 2.5.4 (r254:67916, Jan 20 2010, 21:43:02) [GCC 4.4.1] on linux2 Type help, copyright, credits or license for more information. When ruuning

Re: Python debuggers with sys.settrace()

2010-05-06 Thread Sarah Mount
On 5 May 2010 10:17, Carl Banks pavlovevide...@gmail.com wrote: On May 2, 11:06 am, Sarah Mount mount.sa...@gmail.com wrote: This is a bit of an odd question, but is there any way for a Python debugger to suppress I/O generated by the program which is being debugged? I guess an obvious thing

Re: Python debuggers with sys.settrace()

2010-05-06 Thread Chris Rebert
On Thu, May 6, 2010 at 5:59 AM, Sarah Mount mount.sa...@gmail.com wrote: On 5 May 2010 10:17, Carl Banks pavlovevide...@gmail.com wrote: On May 2, 11:06 am, Sarah Mount mount.sa...@gmail.com wrote: This is a bit of an odd question, but is there any way for a Python debugger to suppress I/O

Re: column selection

2010-05-06 Thread Dave Angel
mannu jha wrote: I tried with this: for line in open('1.txt'): columns = line.split() print columns[0], columns[1] if not line: continue but it is showing error: nmru...@caf:~ python split.py 24 ALA Traceback (most recent call last): File split.py, line 3, in print

fast regex

2010-05-06 Thread james_027
hi, I was working with regex on a very large text, really large but I have time constrained. Does python has any other regex library or string manipulation library that works really fast? Thanks, James -- http://mail.python.org/mailman/listinfo/python-list

Re: fast regex

2010-05-06 Thread Javier Collado
Hello, 2010/5/6 james_027 cai.hai...@gmail.com: I was working with regex on a very large text, really large but I have time constrained. Does python has any other regex library or string manipulation library that works really fast? re2 (http://code.google.com/p/re2/) is suppossed to be faster

Re: fast regex

2010-05-06 Thread John Bokma
james_027 cai.hai...@gmail.com writes: I was working with regex on a very large text, really large but I have time constrained. Does python has any other regex library or string manipulation library that works really fast? Hard to answer without seeing your regex and requirements first. Your

convert Unicode filenames to good-looking ASCII

2010-05-06 Thread coldpizza
Hello, I need to convert accented unicode chars in some audio files to similarly-looking ascii chars. Looks like the following code seems to work on windows: import os import sys import glob EXT = '*.*' lst_uni = glob.glob(unicode(EXT)) os.system('chcp 437') lst_asci = glob.glob(EXT) print

Windows - select.select, timeout and KeyboardInterrupt

2010-05-06 Thread Paul Moore
From a quick experiment, it seems that select.select with a timeout doesn't react to a keyboard interrupt until the timeout expires. Specifically, if I do s = socket.socket() select.select([s], [], [], 30) and then press Ctrl-C, Python waits for the 30 seconds before raising KeyboardInterrupt.

Re: convert Unicode filenames to good-looking ASCII

2010-05-06 Thread Iliya
Try smth like this: import unicodedata def remove_accents(str): nkfd_form = unicodedata.normalize('NFKD', unicode(str)) return u''.join([c for c in nkfd_form if not unicodedata.combining(c)]) -- http://mail.python.org/mailman/listinfo/python-list

Re: matching strings in a large set of strings

2010-05-06 Thread M.-A. Lemburg
Dennis Lee Bieber wrote: On Thu, 29 Apr 2010 11:38:28 +0200, Karin Lagesen karin.lage...@bio.uio.no declaimed the following in comp.lang.python: Hello. I have approx 83 million strings, all 14 characters long. I need to be able to take another string and find out whether this one is

Re: ActiveState using different MS runtime files than official Python release? (was Re: Movable Python or ActivePython)

2010-05-06 Thread Trent Mick
On 10-05-05 5:30 PM, pyt...@bdurham.com wrote: Hi Trent, On 10-05-05 12:04 PM, pyt...@bdurham.com wrote: I just took a look at the ActiveStatre 2.6.5.12 release (zip file version) and noticed that this file does not include the MSVCR90.DLL run time file - it includes MFC*.DLL files instead

Re: convert Unicode filenames to good-looking ASCII

2010-05-06 Thread Peter Otten
coldpizza wrote: Hello, I need to convert accented unicode chars in some audio files to similarly-looking ascii chars. Looks like the following code seems to work on windows: import os import sys import glob EXT = '*.*' lst_uni = glob.glob(unicode(EXT)) os.system('chcp 437')

Re: ActiveState using different MS runtime files than official Python release? (was Re: Movable Python or ActivePython)

2010-05-06 Thread python
Hi Trent, That is probably a bug in the ZIP package (the MSI is by far the primary package for Windows so gets more attention). I've started a bug for this: http://bugs.activestate.com/show_bug.cgi?id=86794 Thank you, Malcolm - Original message - From: Trent Mick

Re: convert Unicode filenames to good-looking ASCII

2010-05-06 Thread coldpizza
Cool! Thanks to both Iliya and Peter! On May 6, 7:34 pm, Peter Otten __pete...@web.de wrote: coldpizza wrote: Hello, I need to convert accented unicode chars in some audio files to similarly-looking ascii chars. Looks like the following code seems to work on windows: import os

how to make a piece of code lowercase, except strings / comment ?

2010-05-06 Thread Stef Mientki
hello, I use Python with some simplifications and a few extensions, as a scripting language for non-programmers. One of the simplifications is that the language should be case-insensitive. This is done by making the code lowercase. But now the strings in the code are also converted to lowercase.

Re: new extension generator for C++

2010-05-06 Thread Rouslan Korneychuk
I have the code up at http://github.com/Rouslan/PyExpose now. Any comments are welcome. -- http://mail.python.org/mailman/listinfo/python-list

Python-URL! - weekly Python news and links (May 5)

2010-05-06 Thread Cameron Laird
[Authored by Gabriel Genellina.] QOTW: Even on alt.haruspicy they cannot do much without a liver now and then... - Peter Otten http://groups.google.com/group/comp.lang.python/msg/7852938d0b92bd7b Mixing bytes and unicode when writing data in Python 3.x:

List comprehension + lambdas - strange behaviour

2010-05-06 Thread Artur Siekielski
Hello. I found this strange behaviour of lambdas, closures and list comprehensions: funs = [lambda: x for x in range(5)] [f() for f in funs] [4, 4, 4, 4, 4] Of course I was expecting the list [0, 1, 2, 3, 4] as the result. The 'x' was bound to the final value of 'range(5)' expression for ALL

Re: Django as exemplary design

2010-05-06 Thread Aahz
In article 4be132f1$0$20639$426a7...@news.free.fr, Bruno Desthuilliers bruno.42.desthuilli...@websiteburo.invalid wrote: The more bad code (mine or not) I have to maintain (or even just read and understand), the more I pay attention to my own design and code quality. Sometimes you only

Re: Windows - select.select, timeout and KeyboardInterrupt

2010-05-06 Thread Thomas Heller
Paul Moore schrieb: From a quick experiment, it seems that select.select with a timeout doesn't react to a keyboard interrupt until the timeout expires. Specifically, if I do s = socket.socket() select.select([s], [], [], 30) and then press Ctrl-C, Python waits for the 30 seconds before

Picking a license (was Re: new extension generator for C++)

2010-05-06 Thread Aahz
In article 4be05d75.7030...@msn.com, Rouslan Korneychuk rousl...@msn.com wrote: The only question I have now is what about licensing? Is that something I need to worry about? Should I go with LGPL, MIT, or something else? Which license you use depends partly on your political philosophy.

Re: List comprehension + lambdas - strange behaviour

2010-05-06 Thread Emile van Sebille
On 5/6/2010 12:34 PM Artur Siekielski said... Hello. I found this strange behaviour of lambdas, closures and list comprehensions: funs = [lambda: x for x in range(5)] funs is now a list of lambda functions that return 'x' (whatever it currently is from whereever it's accessible when

2to3 issues with execfile on python 3.0 on files with encoding

2010-05-06 Thread Fabio Zadrozny
Right now, it seems that the default implementation of execfile in 2to3 is something as: exec(compile(open(file).read()+\n, file, 'exec'), globals, locals) But it seems it won't deal with encodings properly... and also, in CPython just making an open without a close is OK, because of the

Re: List comprehension + lambdas - strange behaviour

2010-05-06 Thread Benjamin Peterson
Artur Siekielski artur.siekielski at gmail.com writes: Of course I was expecting the list [0, 1, 2, 3, 4] as the result. The 'x' was bound to the final value of 'range(5)' expression for ALL defined functions. Can you explain this? Is this only counterintuitive example or an error in

Re: List comprehension + lambdas - strange behaviour

2010-05-06 Thread Raymond Hettinger
On May 6, 9:34 pm, Artur Siekielski artur.siekiel...@gmail.com wrote: Hello. I found this strange behaviour of lambdas, closures and list comprehensions: funs = [lambda: x for x in range(5)] [f() for f in funs] [4, 4, 4, 4, 4] Of course I was expecting the list [0, 1, 2, 3, 4] as the

2to3 as a unittest

2010-05-06 Thread Vincent Davis
I have used 2to3 from the command line. is there a way to run it as a unittest. Actually I guess my question is; is there a built in utility for running py3 compatibility on source code as a unittest? *Vincent Davis 720-301-3003 * vinc...@vincentdavis.net my blog http://vincentdavis.net |

Re: Where is python31.dll?

2010-05-06 Thread Pietro Campesato
Dave Angel wrote: visually? Lots of possibilities there. And if you're not sure, you need to get familiar with Windows quirks. IF you're using Explorer, there are a few ways you could miss a single file out of thousands. Simplest is that the listing is not necessarily completely sorted.

Re: Picking a license (was Re: new extension generator for C++)

2010-05-06 Thread Rouslan Korneychuk
On 05/06/2010 04:22 PM, Aahz wrote: In article4be05d75.7030...@msn.com, Rouslan Korneychukrousl...@msn.com wrote: The only question I have now is what about licensing? Is that something I need to worry about? Should I go with LGPL, MIT, or something else? Which license you use depends

Pydev 1.5.7 Released

2010-05-06 Thread Fabio Zadrozny
Hi All, Pydev 1.5.7 has been released Details on Pydev: http://pydev.org Details on its development: http://pydev.blogspot.com Release Highlights: --- * **Uniquely identifying editors:** * Names are never duplicated * Special treatment for __init__ *

Re: py3 tkinter acceps bytes. why?

2010-05-06 Thread Martin v. Loewis
If I don't want bytes to get passed to tkinter I just have to raise an exception in AsObj, no? Or is it even sufficient to just remove the bytes case? But why would you want that? There are commands which legitimately return bytes, e.g. the file and network io libraries of Tcl (not that you

Re: Django as exemplary design

2010-05-06 Thread Patrick Maupin
On May 4, 5:34 pm, TomF tomf.sess...@gmail.com wrote: On 2010-05-04 07:11:08 -0700, alex23 said: (I also think there's value to be gained in studying _bad_ code, too...) True, although whether that's time well spent is another question. I don't know how this applies to reading other

Re: Picking a license

2010-05-06 Thread Ben Finney
a...@pythoncraft.com (Aahz) writes: In article 4be05d75.7030...@msn.com, Rouslan Korneychuk rousl...@msn.com wrote: The only question I have now is what about licensing? Is that something I need to worry about? Should I go with LGPL, MIT, or something else? Which license you use depends

Re: 2to3 issues with execfile on python 3.0 on files with encoding

2010-05-06 Thread Martin v. Loewis
The default replacement should be really providing a new execfile that gets the encoding in the first 2 lines and opens it with the proper encoding set (and properly closes the stream). No. The default replacement should really open the file in binary mode. Regards, Martin --

Re: Django as exemplary design

2010-05-06 Thread Albert Hopkins
On Thu, 2010-05-06 at 16:38 -0700, Patrick Maupin wrote: I don't know how this applies to reading other peoples' code, but recent research shows we learn more from success than failure That's good to learn, because for years I have been intentionally failing in order to learn from it and

does this exception mean something else?

2010-05-06 Thread Alex Hall
Hi all, I have a file, pasted below for what good it will do, which makes a couple conditional calls to a function called writeDefaults. However, when I manually trigger a condition that causes the function to be called, Python gives me a name error and says that my writeDefaults does not exist. I

Re: Django as exemplary design

2010-05-06 Thread MRAB
Albert Hopkins wrote: On Thu, 2010-05-06 at 16:38 -0700, Patrick Maupin wrote: I don't know how this applies to reading other peoples' code, but recent research shows we learn more from success than failure That's good to learn, because for years I have been intentionally failing in order to

Re: does this exception mean something else?

2010-05-06 Thread Chris Rebert
On Thu, May 6, 2010 at 5:33 PM, Alex Hall mehg...@gmail.com wrote: Hi all, I have a file, pasted below for what good it will do, which makes a couple conditional calls to a function called writeDefaults. However, when I manually trigger a condition that causes the function to be called,

Re: does this exception mean something else?

2010-05-06 Thread MRAB
Alex Hall wrote: Hi all, I have a file, pasted below for what good it will do, which makes a couple conditional calls to a function called writeDefaults. However, when I manually trigger a condition that causes the function to be called, Python gives me a name error and says that my

Extract a bordered, skewed rectangle from an image

2010-05-06 Thread Paul Hemans
We have a scanned document on which a label has been attached. The label has been designed to have a border that makes it easy to determine the correct orientation and area of the label. The label portion of the scanned image needs to be extracted and deskewed as an image. The contents of the

RE: Django as exemplary design

2010-05-06 Thread Trent Nelson
I'm interested in improving my python design by studying a large, well-designed codebase. I'll tell you one of the best ways to improve your Python code: attend one of Raymond Hettinger's Code Clinic workshops at a Python conference and put some up of your work up on the projector for 20+

Re: [Python-ideas] division oddness

2010-05-06 Thread Xavier Ho
On Fri, May 7, 2010 at 11:13 AM, Chris Rebert pyid...@rebertia.com wrote: On Thu, May 6, 2010 at 5:43 PM, Mathias Panzenböck grosser.meister.mo...@gmx.net wrote: Shouldn't by mathematical definition -x // y be the same as -(x // y)? I think this rather odd. Is there any deeper reason to

Re: List comprehension + lambdas - strange behaviour

2010-05-06 Thread Terry Reedy
On 5/6/2010 3:34 PM, Artur Siekielski wrote: Hello. I found this strange behaviour of lambdas, closures and list comprehensions: funs = [lambda: x for x in range(5)] [f() for f in funs] [4, 4, 4, 4, 4] You succumbed to lambda hypnosis, a common malady ;-). The above will not work in 3.x,

Re: does this exception mean something else?

2010-05-06 Thread Terry Reedy
On 5/6/2010 8:33 PM, Alex Hall wrote: Hi all, I have a file, pasted below for what good it will do, which makes a couple conditional calls to a function called writeDefaults. However, when I manually trigger a condition that causes the function to be called, Python gives me a name error and says

Re: does this exception mean something else?

2010-05-06 Thread Alex Hall
Changing the order so the function is first did it. Thanks. That is what I get for working with Java all semester... On 5/6/10, MRAB pyt...@mrabarnett.plus.com wrote: Alex Hall wrote: Hi all, I have a file, pasted below for what good it will do, which makes a couple conditional calls to a

Re: [Python-ideas] division oddness

2010-05-06 Thread Chris Rebert
On Thu, May 6, 2010 at 6:33 PM, Xavier Ho cont...@xavierho.com wrote: On Fri, May 7, 2010 at 11:13 AM, Chris Rebert pyid...@rebertia.com wrote: On Thu, May 6, 2010 at 5:43 PM, Mathias Panzenböck grosser.meister.mo...@gmx.net wrote: Shouldn't by mathematical definition -x // y be the same as

Re: fast regex

2010-05-06 Thread james_027
On May 6, 11:33 pm, John Bokma j...@castleamber.com wrote: james_027 cai.hai...@gmail.com writes: I was working with regex on a very large text, really large but I have time constrained. Does python has any other regex library or string manipulation library that works really fast? Hard to

Re: fast regex

2010-05-06 Thread james_027
On May 6, 11:33 pm, John Bokma j...@castleamber.com wrote: james_027 cai.hai...@gmail.com writes: I was working with regex on a very large text, really large but I have time constrained. Does python has any other regex library or string manipulation library that works really fast? Hard to

Re: fast regex

2010-05-06 Thread Tim Chase
On 05/06/2010 09:11 PM, james_027 wrote: for key, value in words_list.items(): compile = re.compile(r\b%s\b % key, re.IGNORECASE) search = compile.sub(value, content) where the content is a large text about 500,000 characters and the word list is about 5,000 You don't specify what

Re: Django as exemplary design

2010-05-06 Thread TomF
On 2010-05-06 18:20:02 -0700, Trent Nelson said: I'm interested in improving my python design by studying a large, well-designed codebase. I'll tell you one of the best ways to improve your Python code: attend one of Raymond Hettinger's Code Clinic workshops at a Python conference and put some

Re: Picking a license

2010-05-06 Thread Stephen Hansen
On Thu, May 6, 2010 at 4:56 PM, Ben Finney ben+pyt...@benfinney.id.auben%2bpyt...@benfinney.id.au wrote: a...@pythoncraft.com (Aahz) writes: In article 4be05d75.7030...@msn.com, Rouslan Korneychuk rousl...@msn.com wrote: The only question I have now is what about licensing? Is that

Re: fast regex

2010-05-06 Thread james_027
On May 6, 11:33 pm, John Bokma j...@castleamber.com wrote: james_027 cai.hai...@gmail.com writes: I was working with regex on a very large text, really large but I have time constrained. Does python has any other regex library or string manipulation library that works really fast? Hard to

idiomatic way to collect and report multiple exceptions?

2010-05-06 Thread Ben Cohen
Is there a pythonic way to collect and display multiple exceptions at the same time? For example let's say you're trying to validate the elements of a list and you'd like to validate as many of the elements as possible in one run and still report exception's raised while validating a failed

Re: idiomatic way to collect and report multiple exceptions?

2010-05-06 Thread Chris Rebert
On Thu, May 6, 2010 at 8:50 PM, Ben Cohen nco...@ucsd.edu wrote: Is there a pythonic way to collect and display multiple exceptions at the same time? For example let's say you're trying to validate the elements of a list and you'd like to validate as many of the elements as possible in one

Re: [Python-ideas] division oddness

2010-05-06 Thread Terry Reedy
On Thu, May 6, 2010 at 5:43 PM, Mathias Panzenböck Shouldn't by mathematical definition -x // y be the same as -(x// y)? Tradeoffs, tradeoffs. Most everyone agrees on this rule for the relation between // and %: x == y*(x//y) + x%y If // is defined as above, then, for instance, x%2 has 3

Re: idiomatic way to collect and report multiple exceptions?

2010-05-06 Thread Terry Reedy
On 5/6/2010 11:50 PM, Ben Cohen wrote: Is there a pythonic way to collect and display multiple exceptions at the same time? For example let's say you're trying to validate the elements of a list and you'd like to validate as many of the elements as possible in one run and still report

Re: Classes: nested functions vs. private methodes

2010-05-06 Thread Tim Roberts
Richard Lamboj richard.lam...@bilcom.at wrote: Thank you for the nice sample, but what is with multiple inheritance in your sample? I mean the super call. Why not _MyClass.blah(self, arg). Because then I have to remember to change the name if I should happen to change the base class, or copy

Broken pipe

2010-05-06 Thread cerr
Hi There, I'm very new to Python and i wanna write a script that sends a certain string to a server. The code I came up with looks like this: #!/usr/bin/python import sys import string from socket import * usage=USAGE: +sys.argv[0]+ server port; if len(sys.argv) != 3: print usage;

Re: [Python-ideas] division oddness

2010-05-06 Thread Xavier Ho
On Fri, May 7, 2010 at 12:14 PM, Chris Rebert c...@rebertia.com wrote: Personally, I find the following the most unintuitive: divmod(-11, 3) == (-4, 1) So, we overshoot -11 and then add 1 to go back to the right place? That violates my intuitive thought that abs((n//d)*d) = abs(n) ought to

Re: Broken pipe

2010-05-06 Thread Chris Rebert
On Thu, May 6, 2010 at 10:27 PM, cerr ron.egg...@gmail.com wrote: Hi There, I'm very new to Python and i wanna write a script that sends a certain string to a server. The code I came up with looks like this: #!/usr/bin/python import sys import string from socket import * usage=USAGE:

[issue2504] Add gettext.pgettext() and variants support

2010-05-06 Thread Olivier Berten
Olivier Berten olivier.ber...@gmail.com added the comment: Pleeese ;-) -- nosy: +olivier-berten ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2504 ___

[issue2504] Add gettext.pgettext() and variants support

2010-05-06 Thread Martin v . Löwis
Changes by Martin v. Löwis mar...@v.loewis.de: -- versions: +Python 3.2 -Python 2.6, Python 3.0 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2504 ___

[issue7863] platform module doesn't detect Windows 7

2010-05-06 Thread Marc-Andre Lemburg
Marc-Andre Lemburg m...@egenix.com added the comment: Brian Curtin wrote: Brian Curtin cur...@acm.org added the comment: Now that I have access to a Server 2008 R2 machine, I've verified that this fix works there. Committed in r80857 through r80860. Thanks, Brian. --

  1   2   >