virtualenvwrapper for Windows (Powershell)

2010-05-11 Thread guillermooo
Hi, If you've ever missed it on Windows and you can use Powershell, you might want to take a look at this port of virtualenvwrapper: http://bitbucket.org/guillermooo/virtualenvwrapper/wiki/Home It's a work in progress, but is should be fairly functional already. It requires Powershell v2.

[ANN] pylint 0.21 / astng 0.20.1

2010-05-11 Thread Sylvain Thénault
Hi there! I'm pleased to announce a new pylint / astng release. It provides several bug fixes, as well as command line enhancements: all options for messages / reports control have been merged into two generic --enable / --disable option. Also, pylint --help is much more concise, and longer

Version 0.3.9 of the Python config module has been released.

2010-05-11 Thread Vinay Sajip
Version 0.3.9 of the Python config module has been released. What Does It Do? The config module allows you to implement a hierarchical configuration scheme with support for mappings and sequences, cross-references between one part of the configuration and another, the ability to

Re: unable to get Hudson to run unit tests

2010-05-11 Thread Stefan Behnel
j vickroy, 10.05.2010 17:39: Unfortunately, when Hudson Build now is performed, the Hudson Console output, for this job, is: Started by user anonymous Updating svn://vm-svn/GOES data processing/trunk/GOES/13,14,15/SXI/level-1 At

Re: How to measure speed improvements across revisions over time?

2010-05-11 Thread Martin v. Loewis
Matthew Wilson wrote: I know how to use timeit and/or profile to measure the current run-time cost of some code. I want to record the time used by some original implementation, then after I rewrite it, I want to find out if I made stuff faster or slower, and by how much. Other than me

Re: win32com

2010-05-11 Thread mohamed issolah
hey, I need help . 2010/5/9 mohamed issolah isso@gmail.com hey, I wich to have an example please need help 2010/5/9 Chris Rebert c...@rebertia.com On Sun, May 9, 2010 at 1:15 AM, mohamed issolah isso@gmail.com wrote: hey, there is an alternative of win32com in linux?

Re: fast regex

2010-05-11 Thread Paul Rubin
Lawrence D'Oliveiro l...@geek-central.gen.new_zealand writes: “Fast regex” is a contradiction in terms. You use regexes when you want ease of definition and application, not speed. For speed, consider hand-coding your own state machine. Preferably in a compiled language like C. But,

Re: Upgrade Python 2.6.4 to 2.6.5

2010-05-11 Thread Werner F. Bruhin
Martin, Thanks for the quick reply. On 10/05/2010 22:25, Martin v. Loewis wrote: Werner F. Bruhin wrote: Just upgraded on my Windows 7 machine my copy of 2.6.4 to 2.6.5. However doing sys.version still shows 2.6.4 even so python.exe is dated 19. March 2010 with a size of 26.624 bytes.

Iterating a sequence two items at a time

2010-05-11 Thread Ulrich Eckhardt
Hi! I have a list [1,2,3,4,5,6] which I'd like to iterate as (1,2), (3,4), (5,6). I can of course roll my own, but I was wondering if there was already some existing library function that already does this. def as_pairs(seq): i = iter(seq) yield (i.next(), i.next()) Question to this

Re: Is Python a functional programming language?

2010-05-11 Thread Paul Rubin
Luis M. González luis...@gmail.com writes: That doesn't mean python can compete with other purely functional languages, but it's probably as functional as it can be for a more conventional, multiparadigm language. Ben Lippmeier made the interesting claim that one of the defining

Re: Iterating a sequence two items at a time

2010-05-11 Thread Chris Rebert
On Tue, May 11, 2010 at 12:09 AM, Ulrich Eckhardt eckha...@satorlaser.com wrote: Hi! I have a list [1,2,3,4,5,6] which I'd like to iterate as (1,2), (3,4), (5,6). I can of course roll my own, but I was wondering if there was already some existing library function that already does this. When

Re: HTTP Post Request

2010-05-11 Thread kak...@gmail.com
On May 11, 5:06 am, Kushal Kumaran kushal.kumaran+pyt...@gmail.com wrote: On Mon, May 10, 2010 at 8:26 PM, kak...@gmail.com kak...@gmail.com wrote: On May 10, 10:22 am, Kushal Kumaran kushal.kumaran+pyt...@gmail.com wrote: On Mon, May 10, 2010 at 7:30 PM, kak...@gmail.com kak...@gmail.com

Re: Iterating a sequence two items at a time

2010-05-11 Thread Bruno Desthuilliers
Ulrich Eckhardt a écrit : Hi! I have a list [1,2,3,4,5,6] which I'd like to iterate as (1,2), (3,4), (5,6). I can of course roll my own, but I was wondering if there was already some existing library function that already does this. l = range(10) for x, y in zip(l[::2], l[1::2]): ...

inherit from data type

2010-05-11 Thread Richard Lamboj
Hello, i want to inherit from a data type. How can i do this? Can anyone explain more abou this? How knows python that it is a float, or a string? Kind Regards Richi -- http://mail.python.org/mailman/listinfo/python-list

Re: fast regex

2010-05-11 Thread Bryan
Lawrence D'Oliveiro wrote: “Fast regex” is a contradiction in terms. You use regexes when you want ease of definition and application, not speed. Python or Perl regex's are not actually regular expressions. Real regular expression compilers produce blazing fast results, but they cannot support

Re: Iterating a sequence two items at a time

2010-05-11 Thread Ulrich Eckhardt
Ulrich Eckhardt wrote: I have a list [1,2,3,4,5,6] which I'd like to iterate as (1,2), (3,4), (5,6). I can of course roll my own, but I was wondering if there was already some existing library function that already does this. def as_pairs(seq): i = iter(seq) yield (i.next(),

Re: inherit from data type

2010-05-11 Thread Ulrich Eckhardt
Richard Lamboj wrote: i want to inherit from a data type. How can i do this? Can anyone explain more abou this? Other than in e.g. C++ where int and float are special types, you can inherit from them in Python like from any other type. The only speciality of int, float and string is that they

Re: inherit from data type

2010-05-11 Thread James Mills
On Tue, May 11, 2010 at 6:38 PM, Richard Lamboj richard.lam...@bilcom.at wrote: i want to inherit from a data type. How can i do this? Can anyone explain more abou this? How knows python that it is a float, or a string? $ python Python 2.6.5 (r265:79063, Apr 27 2010, 18:26:49) [GCC 4.4.1

Re: inherit from data type

2010-05-11 Thread Bruno Desthuilliers
Richard Lamboj a écrit : Hello, i want to inherit from a data type. How can i do this? Hmmm, let's see... Could it be possible that it's documented somewhere ? Like, in the FineManual(tm) ?-) http://docs.python.org/tutorial/classes.html#inheritance Can anyone explain more abou this? How

How to eliminate Debug: src/helpers.cpp(140): 'CreateActCtx' failed message ?

2010-05-11 Thread Barak, Ron
Hi, I created my first py2exe windows exe, and when it's run, I see on the console: $ ./svm_ts_tool_in_progress.exe 11:49:32: Debug: src/helpers.cpp(140): 'CreateActCtx' failed with error 0x007b (the filename, directory name, or volume label syntax is incorrect.). This is a non-fatal error

Re: inherit from data type

2010-05-11 Thread Richard Lamboj
Am Tuesday 11 May 2010 10:47:35 schrieb Ulrich Eckhardt: Richard Lamboj wrote: i want to inherit from a data type. How can i do this? Can anyone explain more abou this? Other than in e.g. C++ where int and float are special types, you can inherit from them in Python like from any other

How to make this doctest work?

2010-05-11 Thread XieTian
Hello I ran across this accidentally and wonders how to make the doctest in following code snippet work: import doctest def a(): a = '\\r\\n' print a No matter how many blank lines I add here, it just can't get enough -_- pass doctest.testmod() ps: I want

Re: inherit from data type

2010-05-11 Thread Chris Rebert
On Tue, May 11, 2010 at 2:18 AM, Richard Lamboj richard.lam...@bilcom.at wrote: snip What i also want to know: variable1 = 10.50 type(variable1) type 'float' Is there a way to tell python that it use antoher class than float for float, like myfloat? Its just a tell-me-what-is-possible.

Dynamically compiling and reloading SWIG .pyd file

2010-05-11 Thread Dave Guthrie
I am creating an application which has it's code split between python and C. The Python is used to provide a high level GUI interface and the C is for low level functions. I use SWIG to create Python Bindings for the C functions. I want to implement a feature where there is a button in the toolbar

Re: inherit from data type

2010-05-11 Thread Ulrich Eckhardt
Richard Lamboj wrote: How knows python that it is a float, or a string? Sorry this was bad expressed. I want to create a new data type, which inherits from float. I just know the dir function and the help function to get more infromations about the class, but i need to get more information

Re: Picking a license

2010-05-11 Thread Paul Boddie
On 10 Mai, 17:01, Patrick Maupin pmau...@gmail.com wrote: I'll be charitable and assume the fact that you can make that statement without apparent guile merely means that you haven't read the post I was referring to: http://www.gnu.org/philosophy/why-not-lgpl.html Of course I have read it,

Re: HTTP Post Request

2010-05-11 Thread kak...@gmail.com
On May 11, 10:56 am, kak...@gmail.com kak...@gmail.com wrote: On May 11, 5:06 am, Kushal Kumaran kushal.kumaran+pyt...@gmail.com wrote: On Mon, May 10, 2010 at 8:26 PM, kak...@gmail.com kak...@gmail.com wrote: On May 10, 10:22 am, Kushal Kumaran kushal.kumaran+pyt...@gmail.com wrote:

Re: Picking a license

2010-05-11 Thread Paul Boddie
On 10 Mai, 20:36, Patrick Maupin pmau...@gmail.com wrote: I've addressed this before.  Aahz used a word in an accurate, but to you, inflammatory, sense, but it's still accurate -- the man *would* force you to pay for the chocolate if you took it. Yes, *if* you took it. He isn't forcing you to

Re: lame sphinx questions [Was: lame epydoc questions]

2010-05-11 Thread Jean-Michel Pichavant
Phlip wrote: On May 10, 1:51 pm, Phlip phlip2...@gmail.com wrote: On May 10, 1:39 pm, Chris Rebert c...@rebertia.com wrote: Sphinx is in vogue right now:http://sphinx.pocoo.org/ Okay, we have ten thousand classes to document. How to add them all to index.rst? I remember

win32com sql update problem

2010-05-11 Thread Mark Carter
Consider the following snippet of code: import win32com.client DSN = 'PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=M:\\Finance\\camel\ \camel.mdb;' conn.Open(DSN) cursor = conn.Execute(UPDATE tblInvoice SET InvComments='Python' WHERE InvBillingPeriod = 'April 2010' AND InvJobCode = '2169') rows

Re: Is Python a functional programming language?

2010-05-11 Thread Lawrence D'Oliveiro
In message 7xvdavd4bq@ruckus.brouhaha.com, Paul Rubin wrote: Python is a pragmatic language from an imperative tradition ... I thought the opposite of “functional” was “procedural”, not “imperative”. The opposite to the latter is “declarative”. But (nearly) all procedural languages also

Re: Is Python a functional programming language?

2010-05-11 Thread Lawrence D'Oliveiro
In message mailman.2848.1273495992.23598.python-l...@python.org, Stefan Behnel wrote: But the beauty is that Python is multi-paradigm ... The trouble with “multi-paradigm” is that it offends the zealots on all sides. It’s like saying that, to effect a compromise among multiple conflicting

Re: Picking a license

2010-05-11 Thread Steven D'Aprano
On Tue, 11 May 2010 03:34:49 -0700, Paul Boddie wrote: It's like saying that the shopkeeper is some kind of Darth Vader character who is coercing people to take the chocolate Last time I came home with chocolate, I tried that excuse on my wife. She didn't believe it for a second. Next time,

Re: Is Python a functional programming language?

2010-05-11 Thread Stefan Behnel
Lawrence D'Oliveiro, 11.05.2010 13:13: Stefan Behnel wrote: But the beauty is that Python is multi-paradigm ... The trouble with “multi-paradigm” is that it offends the zealots on all sides. It’s like saying that, to effect a compromise among multiple conflicting monotheistic religions, we

unittest basics

2010-05-11 Thread John Maclean
is there a way to test that a certian library or module is or can be loaded successfully? self.assert('import blah') -- John Maclean MSc. (DIC) BSc. (Hons) Linux Systems and Applications 07739 171 531 -- http://mail.python.org/mailman/listinfo/python-list

Re: inherit from data type

2010-05-11 Thread Richard Lamboj
Am Tuesday 11 May 2010 11:38:42 schrieb Ulrich Eckhardt: Richard Lamboj wrote: How knows python that it is a float, or a string? Sorry this was bad expressed. I want to create a new data type, which inherits from float. I just know the dir function and the help function to get more

Re: unittest basics

2010-05-11 Thread Giampaolo Rodolà
There's no reason for such a thing. You can just make import module in your test and if something goes wrong that will be treated as any other test failure. --- Giampaolo http://code.google.com/p/pyftpdlib http://code.google.com/p/psutil 2010/5/11 John Maclean jaye...@gmail.com: is there a way

how to import a module for global use in a library package ?

2010-05-11 Thread Auré Gourrier
Dear all, I am building a library package of the form: rootlib ---__init__ ---subpackage1 --__init__ --sub1module1 --sub1module2 --... ---subpackage2 -- __init__ --sub2module1 --sub2module2 --... My rootlib.__init__ file contains: __name__= ...

Re: how to import a module for global use in a library package ?

2010-05-11 Thread Jean-Michel Pichavant
Auré Gourrier wrote: [snip] My question is the following: I need to import an external package, say numpy, for use in various submodules. So far, I simply do an import numpy as _numpy where needed, say sub1module1 and sub2module2. This means that I import this package a number of times which

Re: virtualenvwrapper for Windows (Powershell)

2010-05-11 Thread Guillermo
On May 11, 7:43 am, Lawrence D'Oliveiro l...@geek- central.gen.new_zealand wrote: In message 22cf35af-44d1-43fe-8b90-07f2c6545...@i10g2000yqh.googlegroups.com, Guillermo wrote: If you've ever missed it on Windows and you can use Powershell ... I thought the whole point of Windows was to

Re: unittest basics

2010-05-11 Thread Chris Withers
import unittest class MyTestCase(unittest.TestCase): def test_my_import(self): import blah cheers, Chris John Maclean wrote: is there a way to test that a certian library or module is or can be loaded successfully? self.assert('import blah') -- Simplistix - Content Management,

Re: How to measure speed improvements across revisions over time?

2010-05-11 Thread exarkun
On 08:13 pm, m...@tplus1.com wrote: I know how to use timeit and/or profile to measure the current run-time cost of some code. I want to record the time used by some original implementation, then after I rewrite it, I want to find out if I made stuff faster or slower, and by how much. Other

Re: virtualenvwrapper for Windows (Powershell)

2010-05-11 Thread David Robinow
On Tue, May 11, 2010 at 1:43 AM, Lawrence D'Oliveiro l...@geek-central.gen.new_zealand wrote: In message 22cf35af-44d1-43fe-8b90-07f2c6545...@i10g2000yqh.googlegroups.com, Guillermo wrote: If you've ever missed it on Windows and you can use Powershell ... I thought the whole point of Windows

reading xml from python

2010-05-11 Thread Hvidberg, Martin
I'm looking for at way to read (and later write) small simple .xml file from Python. e.g. I would like to read the following from a small ini.xml file into a dictionary. ?xml version=1.0 encoding=UTF-8? initialisation idrectorydefault/idrectory nosplitFalse/nosplit nobatchFalse/nobatch

Re: Picking a license

2010-05-11 Thread Lie Ryan
On 05/11/10 20:24, Paul Boddie wrote: On 10 Mai, 17:01, Patrick Maupin pmau...@gmail.com wrote: I'll be charitable and assume the fact that you can make that statement without apparent guile merely means that you haven't read the post I was referring to:

Re: reading xml from python

2010-05-11 Thread Chris Rebert
On Tue, May 11, 2010 at 5:54 AM, Hvidberg, Martin m...@dmu.dk wrote: I'm looking for at way to read (and later write) small simple .xml file from Python. e.g. I would like to read the following from a small ini.xml file into a dictionary. ?xml version=1.0 encoding=UTF-8? initialisation  

Re: reading xml from python

2010-05-11 Thread Philip Semanchuk
On May 11, 2010, at 8:54 AM, Hvidberg, Martin wrote: I'm looking for at way to read (and later write) small simple .xml file from Python. e.g. I would like to read the following from a small ini.xml file into a dictionary. ?xml version=1.0 encoding=UTF-8? initialisation

urllib.urlopen blocking?

2010-05-11 Thread Dominik Gabi
Hi, I'm new to python and have been playing around with it for a few days now. So please forgive me if this is a stupid question :) I've tried writing a little application with pygtk and urllib. When a button is clicked I create a new thread that opens an URL with urllib. The new thread is

Re: lame sphinx questions [Was: lame epydoc questions]

2010-05-11 Thread Phlip
On May 11, 3:54 am, Jean-Michel Pichavant jeanmic...@sequans.com wrote: I remember trying using Sphinx for auto documented APIs, but it was not suitable at that time. You can include API docs generated from the code, but you still need to write the docs around. If I'm correct,  Sphinx is one

Re: urllib.urlopen blocking?

2010-05-11 Thread Antoine Pitrou
On Tue, 11 May 2010 06:22:29 -0700 (PDT) Dominik Gabi dkgis...@gmail.com wrote: I'm new to python and have been playing around with it for a few days now. So please forgive me if this is a stupid question :) I've tried writing a little application with pygtk and urllib. For the record,

Re: Extract all words that begin with x

2010-05-11 Thread Aahz
In article mailman.11.1273548189.32709.python-l...@python.org, Terry Reedy tjre...@udel.edu wrote: On 5/10/2010 5:35 AM, James Mills wrote: On Mon, May 10, 2010 at 6:50 PM, Xavier Hocont...@xavierho.com wrote: Have I missed something, or wouldn't this work just as well: list_of_strings =

Re: lame sphinx questions [Was: lame epydoc questions]

2010-05-11 Thread Jean-Michel Pichavant
Phlip wrote: On May 11, 3:54 am, Jean-Michel Pichavant jeanmic...@sequans.com wrote: I remember trying using Sphinx for auto documented APIs, but it was not suitable at that time. You can include API docs generated from the code, but you still need to write the docs around. If I'm correct,

Re: Picking a license

2010-05-11 Thread Paul Boddie
On 11 Mai, 15:00, Lie Ryan lie.1...@gmail.com wrote: Come on, 99%  of the projects released under GPL did so because they don't want to learn much about the law; they just need to release it under a certain license so their users have some legal certainty. Yes, this is frequently the case.

Slice last char from string without raising exception on empty string (Re: Extract all words that begin with x)

2010-05-11 Thread python
Terry, ... word[0:1] does the same thing. All Python programmers should learn to use slicing to extract a char from a string that might be empty. Is there an equivalent way to slice the last char from a string (similar to an .endswith) that doesn't raise an exception when a string is empty?

Re: urllib.urlopen blocking?

2010-05-11 Thread Dominik Gabi
For the record, have you tried calling gobject.threads_init() at the beginning of your application (just after importing all modules)? I haven't... now it works, thanks :) Any tips on how to avoid mistakes like that in the future? I'm somewhat confused as to how I was supposed to get this out

Re: Is Python a functional programming language?

2010-05-11 Thread Paul Rubin
Lawrence D'Oliveiro l...@geek-central.gen.new_zealand writes: I thought the opposite of “functional” was “procedural”, not “imperative”. The opposite to the latter is “declarative”. But (nearly) all procedural languages also have declarative constructs, not just imperative ones (certainly

Re: unable to get Hudson to run unit tests

2010-05-11 Thread j vickroy
Thanks again, Stefan. My comments are below. Stefan Behnel wrote: j vickroy, 10.05.2010 17:39: Unfortunately, when Hudson Build now is performed, the Hudson Console output, for this job, is: Started by user anonymous Updating

Re: Is Python a functional programming language?

2010-05-11 Thread Michele Simionato
On May 10, 8:18 pm, a...@pythoncraft.com (Aahz) wrote: saying that functional features are tacked on understates the case.  Consider how frequently people reach for list comps and gen exps.  Function dispatch through dicts is the standard replacement for a switch statement.  Lambda callbacks

Re: urllib.urlopen blocking?

2010-05-11 Thread Antoine Pitrou
On Tue, 11 May 2010 07:35:52 -0700 (PDT) Dominik Gabi dkgis...@gmail.com wrote: For the record, have you tried calling gobject.threads_init() at the beginning of your application (just after importing all modules)? I haven't... now it works, thanks :) Any tips on how to avoid mistakes

Re: Extract all words that begin with x

2010-05-11 Thread superpollo
Aahz ha scritto: In article mailman.11.1273548189.32709.python-l...@python.org, Terry Reedy tjre...@udel.edu wrote: On 5/10/2010 5:35 AM, James Mills wrote: On Mon, May 10, 2010 at 6:50 PM, Xavier Hocont...@xavierho.com wrote: Have I missed something, or wouldn't this work just as well:

Re: unable to get Hudson to run unit tests

2010-05-11 Thread Stefan Behnel
j vickroy, 11.05.2010 16:46: Stefan Behnel wrote: No, what Hudson actually does, is, it writes your command(s) into a text file and runs it with the system's shell interpreter (which, unless otherwise configured, is cmd.exe on Windows). This is not the behavior I am experiencing on my Windows

Iterating over dict and removing some elements

2010-05-11 Thread Ulrich Eckhardt
Hi! I wrote a simple loop like this: d = {} ... for k in d: if some_condition(d[k]): d.pop(k) If I run this, Python complains that the dictionary size changed during iteration. I understand that the iterator relies on the internal structure not changing, but how would I

Re: Slice last char from string without raising exception on empty string (Re: Extract all words that begin with x)

2010-05-11 Thread superpollo
pyt...@bdurham.com ha scritto: Terry, ... word[0:1] does the same thing. All Python programmers should learn to use slicing to extract a char from a string that might be empty. Is there an equivalent way to slice the last char from a string (similar to an .endswith) that doesn't raise an

Re: Iterating over dict and removing some elements

2010-05-11 Thread superpollo
Ulrich Eckhardt ha scritto: Hi! I wrote a simple loop like this: d = {} ... for k in d: if some_condition(d[k]): d.pop(k) If I run this, Python complains that the dictionary size changed during iteration. I understand that the iterator relies on the internal structure

PyMPI comm.gather problem

2010-05-11 Thread Peyman Askari
Hi I have run into a serious problem with PyMPI (Python bindings for the Message Passing Interface). Unfortunately I can not provide any example code as it is a massive program (38,000+ lines) and it is very difficult to break the program down due to multiple inheritance. When I run the

Re: Iterating over dict and removing some elements

2010-05-11 Thread Michele Simionato
Or you copy the whole dictionary or you just copy the keys: for k in d.keys(): ... or for k in list(d): ... -- http://mail.python.org/mailman/listinfo/python-list

Re: Iterating over dict and removing some elements

2010-05-11 Thread Jerry Hill
On Tue, May 11, 2010 at 11:08 AM, Ulrich Eckhardt eckha...@satorlaser.com wrote: My first approach was to simply postpone removing the elements, but I was wondering if there was a more elegant solution. Iterate over something other than the actual dictionary, like this: d = {1: 'one', 2:

Re: unable to get Hudson to run unit tests

2010-05-11 Thread j vickroy
Stefan Behnel wrote: j vickroy, 11.05.2010 16:46: Stefan Behnel wrote: No, what Hudson actually does, is, it writes your command(s) into a text file and runs it with the system's shell interpreter (which, unless otherwise configured, is cmd.exe on Windows). This is not the behavior I am

Re: Iterating over dict and removing some elements

2010-05-11 Thread superpollo
superpollo ha scritto: Ulrich Eckhardt ha scritto: Hi! I wrote a simple loop like this: d = {} ... for k in d: if some_condition(d[k]): d.pop(k) If I run this, Python complains that the dictionary size changed during iteration. I understand that the iterator relies on

Re: Slice last char from string without raising exception on empty string (Re: Extract all words that begin with x)

2010-05-11 Thread Jerry Hill
On Tue, May 11, 2010 at 10:37 AM, pyt...@bdurham.com wrote: Is there an equivalent way to slice the last char from a string (similar to an .endswith) that doesn't raise an exception when a string is empty? If you use negative indexes in the slice, they refer to items from the end of the

Re: unable to get Hudson to run unit tests

2010-05-11 Thread j vickroy
Stefan Behnel wrote: j vickroy, 11.05.2010 16:46: Stefan Behnel wrote: No, what Hudson actually does, is, it writes your command(s) into a text file and runs it with the system's shell interpreter (which, unless otherwise configured, is cmd.exe on Windows). This is not the behavior I am

Re: Slice last char from string without raising exception on empty string (Re: Extract all words that begin with x)

2010-05-11 Thread python
Superpollo, word[len(word)-1:] Perfect! Thank you, Malcolm -- http://mail.python.org/mailman/listinfo/python-list

Re: Slice last char from string without raising exception on empty string (Re: Extract all words that begin with x)

2010-05-11 Thread python
Jerry, If you use negative indexes in the slice, they refer to items from the end of the sequence instead of the front. So slicing the last character from the string would be: word[-1:] Perfect! Thank you, Malcolm -- http://mail.python.org/mailman/listinfo/python-list

plot debugging problem

2010-05-11 Thread Sandy Sandy
Hi friends pls help with debugging problem the mutter is: during debugging the debug processes stacks when fig is created for example, in code import random import matplotlib.pyplot as plt from pylab import * x= 23; y = 11; print(23456) plt.plot(range(10)) plot([1,2,3])

graphs in Python during debugging

2010-05-11 Thread Sandy Sandy
Hi friends Can you help pls to find how to plot graphs in Python during debugging without destroying figures to continue to debug the mutter is: during debugging the debug processes stacks when fig is created for example, in code import random import matplotlib.pyplot as plt from pylab

Re: Slice last char from string without raising exception on empty string (Re: Extract all words that begin with x)

2010-05-11 Thread James Mills
On Wed, May 12, 2010 at 2:01 AM, pyt...@bdurham.com wrote: word[len(word)-1:] This works just as well: word[-1:] cheers James -- http://mail.python.org/mailman/listinfo/python-list

Re: Slice last char from string without raising exception on empty string (Re: Extract all words that begin with x)

2010-05-11 Thread superpollo
James Mills ha scritto: On Wed, May 12, 2010 at 2:01 AM, pyt...@bdurham.com wrote: word[len(word)-1:] This works just as well: word[-1:] d'uh. ;-) -- http://mail.python.org/mailman/listinfo/python-list

Re: unable to get Hudson to run unit tests

2010-05-11 Thread Stefan Behnel
j vickroy, 11.05.2010 17:42: Here are the Hudson job | Configure | Execute shell | Command inputs: -- cd level-1 dir nosetests.exe --with-xunit --xunit-file=nosetests.xml --verbose

Re: Problem displaying jpgs in Tkinter via PIL

2010-05-11 Thread Armin
Never mind, I gave up on Tkinter and have switched to wxPython now. Getting jpg images to display in a wx frame worked like a charm... (As I said, I'm very new to Python, so I didn't really know what my options for GUI programming were.) It seems like the ImageTk module on the Enthought

Re: Problem displaying jpgs in Tkinter via PIL

2010-05-11 Thread Antoine Pitrou
On Tue, 11 May 2010 09:57:01 -0700 Armin amphio...@yahoo.com wrote: Never mind, I gave up on Tkinter and have switched to wxPython now. Getting jpg images to display in a wx frame worked like a charm... (As I said, I'm very new to Python, so I didn't really know what my options for GUI

Re: lame sphinx questions [Was: lame epydoc questions]

2010-05-11 Thread Phlip
epydoc supports reStructured text markups. Oh, good. For a moment there, I thought I'd be stuck with a markup language that was persnickety! -- http://mail.python.org/mailman/listinfo/python-list

Re: plot debugging problem

2010-05-11 Thread Matteo Landi
I imagine you have to create a separate thread for it. Just thoughts. On Tue, May 11, 2010 at 6:08 PM, Sandy Sandy c...@live.com wrote: Hi friends pls help with debugging problem the mutter is: during debugging the  debug processes stacks when fig is created for example, in code import

Re: Is Python a functional programming language?

2010-05-11 Thread Terry Reedy
On 5/11/2010 7:11 AM, Lawrence D'Oliveiro wrote: In message7xvdavd4bq@ruckus.brouhaha.com, Paul Rubin wrote: Python is a pragmatic language from an imperative tradition ... I thought the opposite of “functional” was “procedural”, not “imperative”. The opposite to the latter is

Re: inherit from data type

2010-05-11 Thread Terry Reedy
On 5/11/2010 7:51 AM, Richard Lamboj wrote: I just want to test what is possible with python and what not. There is no problem that i need to solve. This is what i'am searching for: http://docs.python.org/reference/datamodel.html Last year i have stopped programming python, but now i'am back

documentation bug? (format spec mini language)

2010-05-11 Thread Alan G Isaac
The documentation at http://docs.python.org/py3k/library/string.html#format-specification-mini-language '' Forces the field to be left-aligned within the available space (This is the default.) The conflicting example:: format(3.2,'10.5f') ' 3.2'

Re: plot debugging problem

2010-05-11 Thread Matteo Landi
Well, I cannot tell you how to do that in a precise way, but googling a bit I found this (expecially the second example): http://eli.thegreenplace.net/2008/08/01/matplotlib-with-wxpython-guis/ Take a look also at the Matplotlib cookbook: http://www.scipy.org/Cookbook/Matplotlib ps. when you

Re: How to make this doctest work?

2010-05-11 Thread Terry Reedy
On 5/11/2010 5:29 AM, XieTian wrote: Hello I ran across this accidentally and wonders how to make the doctest in following code snippet work: import doctest def a(): a = '\\r\\n' print a No matter how many blank lines I add here, it just can't get enough -_-

Pythonw.exe randomly crashing

2010-05-11 Thread Dean Weimer
Hi, I have a python application I wrote that is randomly crashing, I was wondering if anyone else has ran into this error, or if anyone has any idea about how to fix it. This is currently running under Windows server 2008 R2 x64 in terminal services, with Python 2.6.4 x64 installed. I ran into

default argument

2010-05-11 Thread Back9
Hi, Is this grammer working in Python? class test: self._value = 10 def func(self, self._value) When i try it, it complains about undefined self. i don't know why. TIA -- http://mail.python.org/mailman/listinfo/python-list

Re: default argument

2010-05-11 Thread Back9
On May 11, 3:06 pm, Back9 backgoo...@gmail.com wrote: Hi, Is this grammer working in Python? class test:   self._value = 10   def func(self, self._value) When i try it, it complains about undefined self. i don't know why. TIA Sorry here is the what i meant class test: self._value =

Re: documentation bug? (format spec mini language)

2010-05-11 Thread MRAB
Alan G Isaac wrote: The documentation at http://docs.python.org/py3k/library/string.html#format-specification-mini-language '' Forces the field to be left-aligned within the available space (This is the default.) The conflicting example:: format(3.2,'10.5f') '

Re: default argument

2010-05-11 Thread Chris Rebert
On Tue, May 11, 2010 at 12:08 PM, Back9 backgoo...@gmail.com wrote: On May 11, 3:06 pm, Back9 backgoo...@gmail.com wrote: snip When i try it, it complains about undefined self. i don't know why. TIA Sorry here is the what i meant class test:  self._value = 10  def func(self, pos =

Re: Is Python a functional programming language?

2010-05-11 Thread Chris Rebert
On Tue, May 11, 2010 at 11:13 AM, Terry Reedy tjre...@udel.edu wrote: On 5/11/2010 7:11 AM, Lawrence D'Oliveiro wrote: In message7xvdavd4bq@ruckus.brouhaha.com, Paul Rubin wrote: Python is a pragmatic language from an imperative tradition ... I thought the opposite of “functional” was

Re: how to import a module for global use in a library package ?

2010-05-11 Thread Terry Reedy
On 5/11/2010 8:04 AM, Auré Gourrier wrote: Dear all, I am building a library package of the form: rootlib ---__init__ ---subpackage1 --__init__ --sub1module1 --sub1module2 --... ---subpackage2 -- __init__ --sub2module1 --sub2module2 --... My rootlib.__init__

Re: default argument

2010-05-11 Thread Back9
On May 11, 3:20 pm, Chris Rebert c...@rebertia.com wrote: On Tue, May 11, 2010 at 12:08 PM, Back9 backgoo...@gmail.com wrote: On May 11, 3:06 pm, Back9 backgoo...@gmail.com wrote: snip When i try it, it complains about undefined self. i don't know why. TIA Sorry here is the what i

First Timer

2010-05-11 Thread Donna Lane
I have downloaded Python and I'm a beginner in every sense. What I want to know now is when I am in Idle and have made a syntax error how do I repair? After the error I can't type in anything and I get this bing noise. Usually I just start idle over again. Thanks to anyone out there who

Re: Iterating over dict and removing some elements

2010-05-11 Thread Terry Reedy
On 5/11/2010 11:29 AM, Jerry Hill wrote: On Tue, May 11, 2010 at 11:08 AM, Ulrich Eckhardt eckha...@satorlaser.com wrote: My first approach was to simply postpone removing the elements, but I was wondering if there was a more elegant solution. Iterate over something other than the actual

Re: inherit from data type

2010-05-11 Thread Richard Lamboj
Am Tuesday 11 May 2010 20:16:50 schrieb Terry Reedy: On 5/11/2010 7:51 AM, Richard Lamboj wrote: I just want to test what is possible with python and what not. There is no problem that i need to solve. This is what i'am searching for: http://docs.python.org/reference/datamodel.html

Re: fast regex

2010-05-11 Thread Nobody
On Tue, 11 May 2010 17:48:41 +1200, Lawrence D'Oliveiro wrote: I was working with regex on a very large text, really large but I have time constrained. “Fast regex” is a contradiction in terms. Not at all. A properly-written regexp engine will be limited only by memory bandwidth, provided

Limitation of os.walk

2010-05-11 Thread kj
I want implement a function that walks through a directory tree and performs an analsysis of all the subdirectories found. The task has two essential requirements that, AFAICT, make it impossible to use os.walk for this: 1. I need to be able to prune certain directories from being visited.

  1   2   3   >