Re: First Timer

2010-05-11 Thread Mensanator
On May 11, 9:32 pm, Terry Reedy wrote: > On 5/11/2010 7:03 PM, Mensanator wrote: > > > On May 11, 4:37 pm, Terry Reedy  wrote: > > >> In the command line interpreter, you should be able to hit up > >> arrow and have the line above copied to the current entry line for > >> correction. In IDLE, this

Re: PEP 3119 ABC - And how I learned to love the Abstract Bomb

2010-05-11 Thread Gabriel Genellina
En Wed, 12 May 2010 01:38:47 -0300, Hatem Nassrat escribió: 1. To create a YajlContentHandler class that forces all sub-classers to implement a certain set of methods. (Great, thats what ABC is for) There is a certain set of mutually exclusive callbacks, i.e. if you implement the first set y

Re: Extract all words that begin with x

2010-05-11 Thread Aahz
In article , Terry Reedy wrote: > >.startswith and .endswith are methods that wrap the special cases of >slice at an end and compare to one value. There are not necessary, and >save no keystrokes, but Guido obviously thought they added enough to >more than balance the slight expansion of the l

PEP 3119 ABC - And how I learned to love the Abstract Bomb

2010-05-11 Thread Hatem Nassrat
Today I was doing a major re-write of a library I called yajl-py that wraps the json 'sax-like' c-parser yajl, and decided I should look into absract base classes since I knew they had been added to py26. Truthfully, I was surprised when I found out that the BDFL accepted this PEP, but hey were in

Re: Fastest way to calculate leading whitespace

2010-05-11 Thread dasacc22
On May 10, 2:25 am, Stefan Behnel wrote: > Stefan Behnel, 10.05.2010 08:54: > > > > > > > dasacc22, 08.05.2010 19:19: > >> This is a simple question. I'm looking for the fastest way to > >> calculate the leading whitespace (as a string, ie ' '). > > > Here is an (untested) Cython 0.13 solution: >

Why the inconsistent of those two base64 methods?

2010-05-11 Thread Leo Jay
I'd like to encode a string in base64, but I found a inconsistent of two methods: >>> 'aaa'.encode('base64') 'YWFh\n' >>> import base64 >>> base64.b64encode('aaa') 'YWFh' >>> as you can see, the result of 'aaa'.encode('base64') has a '\n' at the end, but the other method doesn't. Why the incons

Re: Upgrade Python 2.6.4 to 2.6.5

2010-05-11 Thread Martin v. Löwis
> If we install over an existing version of Python 2.6.5, will our PTH > files and site-packages be preserved? > > Or do we need to back out our 3rd party packages, install Python 2.6.5 > and then manually restore our 3rd party packages? An upgrade installation will only replace the Python files,

Re: Picking a license

2010-05-11 Thread Lie Ryan
On 05/12/10 07:02, Patrick Maupin wrote: > On May 11, 9:00 am, Paul Boddie wrote: >> On 11 Mai, 15:00, Lie Ryan 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 t

Re: HTTP Post Request

2010-05-11 Thread Kushal Kumaran
On Tue, May 11, 2010 at 3:59 PM, kak...@gmail.com wrote: > On May 11, 10:56 am, "kak...@gmail.com" wrote: >> On May 11, 5:06 am, Kushal Kumaran >> wrote: >> >> >> >> > On Mon, May 10, 2010 at 8:26 PM, kak...@gmail.com wrote: >> > > On May 10, 10:22 am, Kushal Kumaran >> > > wrote: >> > >> On M

Re: Limitation of os.walk

2010-05-11 Thread Tim Chase
05/11/2010 09:07 PM, Terry Reedy wrote: PS: I never understood why os.walk does not support hooks for key events during such a tree traversal. Either 1) it is intentionally simple, with the expectation that people would write there own code for more complicated uses or 2) no one has submitted

Re: virtualenvwrapper for Windows (Powershell)

2010-05-11 Thread Lawrence D'Oliveiro
In message <973ca0fa-4a2f-4e3b-91b9-e38917885...@d27g2000yqc.googlegroups.com>, Guillermo wrote: > On May 11, 7:43 am, Lawrence D'Oliveiro > wrote: > >> In message >> <22cf35af-44d1-43fe-8b90-07f2c6545...@i10g2000yqh.googlegroups.com>, >> >> Guillermo wrote: >> >>> If you've ever missed it on Wi

Re: First Timer

2010-05-11 Thread Terry Reedy
On 5/11/2010 7:03 PM, Mensanator wrote: On May 11, 4:37 pm, Terry Reedy wrote: In the command line interpreter, you should be able to hit up arrow and have the line above copied to the current entry line for correction. In IDLE, this does not yet work, It doesn't have to. Simply place the cu

Re: Extract all words that begin with x

2010-05-11 Thread Terry Reedy
On 5/11/2010 6:01 PM, Bryan wrote: Tycho Andersen wrote: Terry Reedy wrote: ... 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. The method call of .startswith() will be slower, I am sure. Why? Isn't slic

How to pass file descriptor through dbus call in python

2010-05-11 Thread Zhang, Zhenhua
Hi, Hi, DBus 1.3 supports passing file descriptor through dbus method call. So I am writing a python test case to verify my interface. Can someone answer my question: how to pass a file descriptor through python-dbus call? For example: import os m, s = os.openpty()

Re: Limitation of os.walk

2010-05-11 Thread Terry Reedy
On 5/11/2010 3:49 PM, kj wrote: 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 d

Re: Upgrade Python 2.6.4 to 2.6.5

2010-05-11 Thread Terry Reedy
On 5/11/2010 5:27 PM, pyt...@bdurham.com wrote: Martin, If we install over an existing version of Python 2.6.5, will our PTH files and site-packages be preserved? Or do we need to back out our 3rd party packages, install Python 2.6.5 and then manually restore our 3rd party packages? In my exp

Re: Is Python a functional programming language?

2010-05-11 Thread Paul Rubin
Nobody writes: >> is called an "equation" rather than an "assignment". It declares "x is >> equal to 3", rather than directing x to be set to 3. If someplace else in >> the program you say "x = 4", that is an error, normally caught by the >> compiler, since x cannot be equal to both 3 and 4. > >

Re: py2exe help

2010-05-11 Thread jim-on-linux
I appreciate the help, it's working. jim-on-linux > jim-on-linux wrote in > news:mailman.74.1273614703.32709.python-l...@python.org > > in comp.lang.python: > > python help, > > > > I'm open for suggestions. > > > > I'm using py2exe to compile a working program. > > > > The program runs and

Re: Limitation of os.walk

2010-05-11 Thread kj
In Tim Chase writes: >That said, the core source for os.walk() is a whole 23 >lines of code, it's easy enough to just clone it and add what you >need... Thanks, that was a good idea. ~K -- http://mail.python.org/mailman/listinfo/python-list

Re: First Timer

2010-05-11 Thread Mensanator
On May 11, 4:37 pm, Terry Reedy wrote: > On 5/11/2010 3:28 PM, Donna Lane wrote: > > > I have downloaded Python and I'm a beginner in every sense. > > Welcome. I hope you enjoy Python too. > >  > What I want to> know now is when I am in Idle and have made a syntax error > how do I repair? > > Aft

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 f

Re: py2exe help

2010-05-11 Thread Rob Williscroft
jim-on-linux wrote in news:mailman.74.1273614703.32709.python-l...@python.org in comp.lang.python: > python help, > > I'm open for suggestions. > > I'm using py2exe to compile a working program. > > The program runs and prints fine until I compile it with py2exe. > > After compiling the prog

Re: open(False) in python3

2010-05-11 Thread Gabriel Genellina
En Tue, 11 May 2010 18:40:36 -0300, geremy condra escribió: I'm unsure if this qualifies as a bug (it is also clearly user error) but I just ran into a situation where open() was inadvertantly called on a False, and I was somewhat surprised to see that this didn't bail horribly, but rather

Re: Extract all words that begin with x

2010-05-11 Thread Bryan
Tycho Andersen wrote: > Terry Reedy wrote: > >  ... 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. > > The method call of .startswith() will be slower, I am sure. > > Why? Isn't slicing just sugar for a met

Re: Limitation of os.walk

2010-05-11 Thread Tim Chase
On 05/11/2010 02:49 PM, kj wrote: 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 di

py2exe help

2010-05-11 Thread jim-on-linux
python help, I'm open for suggestions. I'm using py2exe to compile a working program. The program runs and prints fine until I compile it with py2exe. After compiling the program, it runs fine until it tries to import the win32ui module, v2.6214.0. Then, I get a windows error message: Impo

open(False) in python3

2010-05-11 Thread geremy condra
I'm unsure if this qualifies as a bug (it is also clearly user error) but I just ran into a situation where open() was inadvertantly called on a False, and I was somewhat surprised to see that this didn't bail horribly, but rather hung forever. Here's some example sessions for python3.x and python2

Re: First Timer

2010-05-11 Thread Terry Reedy
On 5/11/2010 3:28 PM, Donna Lane wrote: I have downloaded Python and I'm a beginner in every sense. Welcome. I hope you enjoy Python too. > 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 n

Re: Upgrade Python 2.6.4 to 2.6.5

2010-05-11 Thread python
Martin, If we install over an existing version of Python 2.6.5, will our PTH files and site-packages be preserved? Or do we need to back out our 3rd party packages, install Python 2.6.5 and then manually restore our 3rd party packages? Thank you, Malcolm -- http://mail.python.org/mailman/listin

Re: default argument

2010-05-11 Thread Terry Reedy
On 5/11/2010 3:41 PM, Back9 wrote: self._value will be instance variable Then set it in the __init__ method. Read the tutorial and ref manual on Python class statements, which are a bit different from what you might be used to. -- http://mail.python.org/mailman/listinfo/python-list

Re: Upgrade Python 2.6.4 to 2.6.5

2010-05-11 Thread Martin v. Loewis
> When will it install into system32? When you install "for all users". >> Did the upgrade inform you that it was an upgrade, or did it warn you >> that you would overwrite the previous installation? >> > It warned me that there is a previous installation. Hmm. You don't remember the exact m

Re: documentation bug? (format spec mini language)

2010-05-11 Thread Terry Reedy
On 5/11/2010 3:19 PM, MRAB wrote: 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

Re: Picking a license

2010-05-11 Thread Patrick Maupin
On May 11, 6:18 am, Steven D'Aprano wrote: > Last time I came home with chocolate, I tried that excuse on my wife. She > didn't believe it for a second. > > Next time, I'll try claiming that I was obliged to eat the chocolate > because of the GPL. Good luck with that. Women can always see right

Re: Picking a license

2010-05-11 Thread Patrick Maupin
On May 11, 9:00 am, Paul Boddie wrote: > On 11 Mai, 15:00, Lie Ryan 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. > > Ye

Re: Picking a license

2010-05-11 Thread Patrick Maupin
On May 11, 5:34 am, Paul Boddie wrote: > On 10 Mai, 20:36, Patrick Maupin 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*

Re: default argument

2010-05-11 Thread Dave Angel
Back9 wrote: On May 11, 3:20 pm, Chris Rebert wrote: On Tue, May 11, 2010 at 12:08 PM, Back9 wrote: On May 11, 3:06 pm, Back9 wrote: When i try it, it complains about undefined self. i don't know why. TIA Sorry here is the what i meant cla

Re: Picking a license

2010-05-11 Thread Patrick Maupin
On May 11, 5:24 am, Paul Boddie wrote: > On 10 Mai, 17:01, Patrick Maupin 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-

Re: documentation bug? (format spec mini language)

2010-05-11 Thread Alan G Isaac
On 5/11/2010 3:19 PM, MRAB wrote: You usually want numbers to be right-aligned so that the decimal points line up when writing a columns of them. Yes. I'm not questioning the wisdom of the implementation, just the documentation of it. Thanks, Alan -- http://mail.python.org/mailman/listinfo/

Re: Is Python a functional programming language?

2010-05-11 Thread Nobody
On Tue, 11 May 2010 23:13:10 +1200, Lawrence D'Oliveiro wrote: >> But the beauty is that Python is multi-paradigm ... > > The trouble with “multi-paradigm” is that it offends the zealots on > all sides. Is that how you view people who like languages to exhibit a degree of consistency? Some peopl

Re: Is Python a functional programming language?

2010-05-11 Thread Lie Ryan
On 05/12/10 05:25, Chris Rebert wrote: > On Tue, May 11, 2010 at 11:13 AM, Terry Reedy wrote: >> On 5/11/2010 7:11 AM, Lawrence D'Oliveiro wrote: >>> In message<7xvdavd4bq@ruckus.brouhaha.com>, Paul Rubin wrote: >>> Python is a pragmatic language from an imperative tradition ... >>> >>> I

Re: Is Python a functional programming language?

2010-05-11 Thread Nobody
On Tue, 11 May 2010 07:36:30 -0700, Paul Rubin wrote: > Offhand I can't tell that imperative and procedural mean something > different. Both basically mean that the programmer specifies a series of > steps for the computer to carry out. Functional languages are mostly > declarative; for example,

Re: First Timer

2010-05-11 Thread Chris Rebert
On Tue, May 11, 2010 at 12:28 PM, Donna Lane wrote: > 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

Re: Is Python a functional programming language?

2010-05-11 Thread Terry Reedy
On 5/11/2010 3:25 PM, Chris Rebert wrote: On Tue, May 11, 2010 at 11:13 AM, Terry Reedy wrote: On 5/11/2010 7:11 AM, Lawrence D'Oliveiro wrote: In message<7xvdavd4bq@ruckus.brouhaha.com>, Paul Rubin wrote: Python is a pragmatic language from an imperative tradition ... I thought the op

Re: default argument

2010-05-11 Thread j vickroy
Back9 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 ... not exactly; try: class Test: _value = 10 def func(self): print id(self._value), self._v

Re: default argument

2010-05-11 Thread Chris Rebert
On Tue, May 11, 2010 at 12:41 PM, Back9 wrote: > On May 11, 3:20 pm, Chris Rebert wrote: >> On Tue, May 11, 2010 at 12:08 PM, Back9 wrote: >> > On May 11, 3:06 pm, Back9 wrote: >> >> >> When i try it, it complains about undefined self. >> >> >> i don't know why. >> >> >> TIA >> >> > Sorry >> >

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. 2.

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, provi

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/datamode

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 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 =

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 respond

Re: default argument

2010-05-11 Thread Back9
On May 11, 3:20 pm, Chris Rebert wrote: > On Tue, May 11, 2010 at 12:08 PM, Back9 wrote: > > On May 11, 3:06 pm, Back9 wrote: > > >> 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: 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__ fil

Re: Is Python a functional programming language?

2010-05-11 Thread Chris Rebert
On Tue, May 11, 2010 at 11:13 AM, Terry Reedy wrote: > On 5/11/2010 7:11 AM, Lawrence D'Oliveiro wrote: >> 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 “proc

Re: default argument

2010-05-11 Thread Chris Rebert
On Tue, May 11, 2010 at 12:08 PM, Back9 wrote: > On May 11, 3:06 pm, Back9 wrote: >> 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 = self._value) You're still defin

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 Back9
On May 11, 3:06 pm, Back9 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 = 10 de

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

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 th

Re: How to make this doctest work?

2010-05-11 Thread Terry Reedy
On 5/11/2010 5:29 AM, Xie&Tian 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

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 ans

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: 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 w

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 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 “declarat

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 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 random > >

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: Problem displaying jpgs in Tkinter via PIL

2010-05-11 Thread Antoine Pitrou
On Tue, 11 May 2010 09:57:01 -0700 Armin 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 programming were.)

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 distri

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: 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, wrote: word[len(word)-1:] This works just as well: word[-1:] d'uh. ;-) -- 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 James Mills
On Wed, May 12, 2010 at 2:01 AM, wrote: >> word[len(word)-1:] This works just as well: >>> word[-1:] cheers James -- http://mail.python.org/mailman/listinfo/python-list

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

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])

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

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: 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 e

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, 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 sequence instead of the

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 th

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 e

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 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: 'two', 3: 'three'} for k i

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

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 progra

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 not

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 ex

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 str

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 Windo

Re: Extract all words that begin with x

2010-05-11 Thread superpollo
Aahz ha scritto: In article , Terry Reedy wrote: On 5/10/2010 5:35 AM, James Mills wrote: On Mon, May 10, 2010 at 6:50 PM, Xavier Ho wrote: Have I missed something, or wouldn't this work just as well: list_of_strings = ['2', 'awes', '3465sdg', 'dbsdf', 'asdgas'] [word for word in list_of_

Re: urllib.urlopen blocking?

2010-05-11 Thread Antoine Pitrou
On Tue, 11 May 2010 07:35:52 -0700 (PDT) Dominik Gabi 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 > like that in th

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 callba

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 svn:

Re: Is Python a functional programming language?

2010-05-11 Thread Paul Rubin
Lawrence D'Oliveiro 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 Python does). Presumably an “im

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

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: Picking a license

2010-05-11 Thread Paul Boddie
On 11 Mai, 15:00, Lie Ryan 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. And the GPL does

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 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 of the b

Re: Extract all words that begin with x

2010-05-11 Thread Aahz
In article , Terry Reedy wrote: >On 5/10/2010 5:35 AM, James Mills wrote: >> On Mon, May 10, 2010 at 6:50 PM, Xavier Ho wrote: >>> Have I missed something, or wouldn't this work just as well: >>> >> list_of_strings = ['2', 'awes', '3465sdg', 'dbsdf', 'asdgas'] >> [word for word in list_o

Re: urllib.urlopen blocking?

2010-05-11 Thread Antoine Pitrou
On Tue, 11 May 2010 06:22:29 -0700 (PDT) Dominik Gabi 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, have you tried ca

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

2010-05-11 Thread Phlip
On May 11, 3:54 am, Jean-Michel Pichavant 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 of the best tool to

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 runnin

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. default False False UBMlight True I would prefer a relative si

Re: reading xml from python

2010-05-11 Thread Chris Rebert
On Tue, May 11, 2010 at 5: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. > > > > >  default >  False >  False >  UBMlight >  True >

  1   2   >