PyPad 2.7.1 (Update 2)

2011-05-14 Thread Jon D
Hi All, PyPad 2.7.1 Update 2 is now available on the AppStore. This is mainly a bug fix release addressing a number of issues with the interactive mode, but does also add some colour highlighting of output. PyPad is a port of the standard python code base to the iPad. It includes most of the

faulthandler 2.0

2011-05-14 Thread Victor Stinner
When a user reports that your program crashes or hangs, sometimes you can only help to try and collect more information and outline a scenario to reproduce the situation. Even with a reliable user scenario, as a developer you are often unable to reproduce the situation due to environment

Roundup 1.4.17 released

2011-05-14 Thread Ralf Schlatterbeck
I'm proud to release version 1.4.17 of Roundup which introduces some minor features and, as usual, fixes some bugs: Features: - Allow declaration of default_values for properties in schema. - Add explicit Search permissions, see Security Fix below. - Add lookup method to xmlrpc interface (Ralf

ANN: NumPy 1.6.0

2011-05-14 Thread Ralf Gommers
Hi, I am pleased to announce the release of NumPy 1.6.0. This release is the result of 9 months of work, and includes many new features, performance improvements and bug fixes. Some highlights are: - Re-introduction of datetime dtype support to deal with dates in arrays. - A new 16-bit

Camelot 11.05.13

2011-05-14 Thread erikj
Hello, Camelot 11.05.13 has been released, and available from PyPi or http://www.python-camelot.com/ ** What is Camelot ** Camelot is an open source framework that leverages Python, SQLAlchemy and Qt to build rich desktop applications. Many built in features make applications built with Camelot

turn monitor off and on

2011-05-14 Thread Astan Chee
Hi, I'm trying to turn off my monitor, pause and then turn it on again. I'm doing this in python 2.6 and windows xp. Here is my script so far (that doesn't work): import time import win32gui import win32con import win32api def turnOffMonitor(): SC_MONITORPOWER = 0xF170

Re: checking if a list is empty

2011-05-14 Thread Ian Kelly
On Fri, May 13, 2011 at 10:47 PM, harrismh777 harrismh...@charter.net wrote: http://www.inf.ed.ac.uk/teaching/courses/inf1/fp/ http://www.cs.ou.edu/~rlpage/fpclassSpring97/ There are lots of these...   the two above afaik are still doing this at the entry level...    ... supposedly, these

Re: Python enabled gdb on Windows and relocation

2011-05-14 Thread Doug Evans
On Thu, May 12, 2011 at 9:19 AM, Ruben Van Boxem vanboxem.ru...@gmail.com wrote: (now in plain-text as required by gdb mailing list) Hi, I am currently trying to integrate Python support into my toolchain build (including GDB of course). It is a sysrooted binutils+GCC+GDB+mingw-w64

Re: turn monitor off and on

2011-05-14 Thread harrismh777
Astan Chee wrote: import time import win32gui import win32con import win32api def turnOffMonitor(): SC_MONITORPOWER = 0xF170 win32gui.SendMessage(win32con.HWND_BROADCAST, win32con.WM_SYSCOMMAND, SC_MONITORPOWER, 2) def turnOnMonitor(): SC_MONITORPOWER = 0xF170

Re: turn monitor off and on

2011-05-14 Thread harrismh777
harrismh777 wrote: def turnOnMonitor(): SC_MONITORPOWER = 0xF170 win32gui.SendMessage(win32con.HWND_BROADCAST, win32con.WM_SYSCOMMAND, SC_MONITORPOWER, -1) I've never tried turning my monitor on/off without using my finger... gonna have to play with this... wouldn't that be a great

Re: how to install easy_install

2011-05-14 Thread rusi
On May 13, 11:29 pm, Ian Kelly ian.g.ke...@gmail.com wrote: On Fri, May 13, 2011 at 11:40 AM, rusi rustompm...@gmail.com wrote: I tried to install easy_install (This is on windows) I downloaded the executable and ran it. It claimed to have done its job. But now when I type easy_install

Re: turn monitor off and on

2011-05-14 Thread harrismh777
harrismh777 wrote: def turnOnMonitor(): SC_MONITORPOWER = 0xF170 win32gui.SendMessage(win32con.HWND_BROADCAST, win32con.WM_SYSCOMMAND, SC_MONITORPOWER, -1) Wonder what the equivalent of this is in Linux... ? -- http://mail.python.org/mailman/listinfo/python-list

Re: checking if a list is empty

2011-05-14 Thread Steven D'Aprano
On Thu, 12 May 2011 23:46:12 -0700, rusi wrote: Mathematics has existed for millenia. Hindu-arabic numerals (base-10 numbers) have been known for about one millennium The boolean domain is only a 100 years old. Unsurprisingly it is not quite 'first-class' yet: See

Re: unicode by default

2011-05-14 Thread harrismh777
Terry Reedy wrote: Is there a unix linux package that can be installed that drops at least 'one' default standard font that will be able to render all or 'most' (whatever I mean by that) code points in unicode? Is this a Python issue at all? Easy, practical use of unicode is still a work in

Re: turn monitor off and on

2011-05-14 Thread Steven D'Aprano
On Sat, 14 May 2011 02:20:55 -0500, harrismh777 wrote: harrismh777 wrote: def turnOnMonitor(): SC_MONITORPOWER = 0xF170 win32gui.SendMessage(win32con.HWND_BROADCAST, win32con.WM_SYSCOMMAND, SC_MONITORPOWER, -1) I've never tried turning my monitor on/off without using my

Re: checking if a list is empty

2011-05-14 Thread rusi
On May 14, 12:39 pm, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: On Thu, 12 May 2011 23:46:12 -0700, rusi wrote: Mathematics has existed for millenia. Hindu-arabic numerals (base-10 numbers) have been known for about one millennium The boolean domain is only a 100 years

Re: turn monitor off and on

2011-05-14 Thread Alexander Kapps
On 14.05.2011 09:29, harrismh777 wrote: harrismh777 wrote: def turnOnMonitor(): SC_MONITORPOWER = 0xF170 win32gui.SendMessage(win32con.HWND_BROADCAST, win32con.WM_SYSCOMMAND, SC_MONITORPOWER, -1) Wonder what the equivalent of this is in Linux... ? Probably xset dpms force {on,off,...} --

Re: turn monitor off and on

2011-05-14 Thread harrismh777
Steven D'Aprano wrote: I've never tried turning my monitor on/off without using my finger... You've never had your PC turn your monitor off after X minutes of inactivity? I know you're being funny, but actually, no-- I don't. That's a back-in-the-day thing... all of my monitors (and I

Re: unicode by default

2011-05-14 Thread Nobody
On Fri, 13 May 2011 14:53:50 -0500, harrismh777 wrote: The unicode consortium is very careful to make sure that thousands of symbols have a unique code point (that's great !) but how do these thousands of symbols actually get displayed if there is no font consortium? Are there

Re: How best to convert a string list to a python list

2011-05-14 Thread Nobody
On Fri, 13 May 2011 10:15:29 -0700, noydb wrote: I want some code to take the items in a semi-colon-delimted string list and places each in a python list. I came up with below. In the name of learning how to do things properly, do you experts have a better way of doing it? x =

Re: Parsing a graph image

2011-05-14 Thread Paul
On May 13, 11:19 pm, Bastian Ballmann ba...@chaostal.de wrote: Hi python lovers out there, I am searching for a library to parse data from a graph in an image file something likehttp://pytseries.sourceforge.net/_images/yahoo.png Any suggestions, hints, links? TIA have a nice day! :)

Re: how to install easy_install

2011-05-14 Thread TheSaint
rusi wrote: tried to install easy_install (This is on windows) I downloaded the executable and ran it. It claimed to have done its job. Perhaps, the abit to just click is disordering some easy steps like copy the script files into the normal place. Only when there's a particular copy then

Re: checking if a list is empty

2011-05-14 Thread Hans Mulder
On 07/05/2011 02:43, Jon Clements wrote: On May 7, 12:51 am, Ian Kellyian.g.ke...@gmail.com wrote: On Fri, May 6, 2011 at 4:21 PM, Philip Semanchukphi...@semanchuk.com wrote: What if it's not a list but a tuple or a numpy array? Often I just want to iterate through an element's items and I

Converting a set into list

2011-05-14 Thread TheSaint
Hello I've stumble to find a solution to get a list from a set code aa= ['a','b','c','f'] aa ['a', 'b', 'c', 'f'] set(aa) {'a', 'c', 'b', 'f'} [k for k in aa] ['a', 'b', 'c', 'f'] /code I repute the comprehension list too expensive, is there another method? -- goto /dev/null --

Re: Python enabled gdb on Windows and relocation

2011-05-14 Thread Ruben Van Boxem
2011/5/14 Doug Evans d...@google.com: On Thu, May 12, 2011 at 9:19 AM, Ruben Van Boxem vanboxem.ru...@gmail.com wrote: (now in plain-text as required by gdb mailing list) Hi, I am currently trying to integrate Python support into my toolchain build (including GDB of course). It is a

Re: Python enabled gdb on Windows and relocation

2011-05-14 Thread Eli Zaretskii
Date: Sat, 14 May 2011 11:09:13 +0200 From: Ruben Van Boxem vanboxem.ru...@gmail.com Cc: g...@sourceware.org, python-list@python.org 1. Check hardcoded path; my suggestion would be gdb executable/../lib/python27 2. If this fails to find the necessary files/scripts, find it like you

Re: Converting a set into list

2011-05-14 Thread Peter Otten
TheSaint wrote: I've stumble to find a solution to get a list from a set code aa= ['a','b','c','f'] aa ['a', 'b', 'c', 'f'] set(aa) To clarify: this creates a new object, so aa is still a list. {'a', 'c', 'b', 'f'} [k for k in aa] ['a', 'b', 'c', 'f'] So you are actually

Re: Python enabled gdb on Windows and relocation

2011-05-14 Thread Ruben Van Boxem
2011/5/14 Eli Zaretskii e...@gnu.org: Date: Sat, 14 May 2011 11:09:13 +0200 From: Ruben Van Boxem vanboxem.ru...@gmail.com Cc: g...@sourceware.org, python-list@python.org 1. Check hardcoded path; my suggestion would be gdb executable/../lib/python27 2. If this fails to find the necessary

Re: How best to convert a string list to a python list

2011-05-14 Thread Daniel Kluev
On Sat, May 14, 2011 at 7:41 PM, Nobody nob...@nowhere.com wrote: to use a regular expression to match everything up to the next delimiter, and do this in a loop to extract the individual items. re.findall() should let you match all items at once, without loop. -- With best regards, Daniel

Re: unicode by default

2011-05-14 Thread jmfauth
On 14 mai, 09:41, harrismh777 harrismh...@charter.net wrote: ... I'm getting much closer here, ... You should really understand, that Unicode is a domain per se. It is independent from any os's, programming languages or applications. It is up to these tools to be unicode compliant. Working

Having a problem getting python working...

2011-05-14 Thread Chris Paton
Hey all, Not sure if this is the right place to put this (forgive me for my ignorance, I'm looking everywhere!). I'm having a problem getting IDLE working. I'm working off Mac OSX 10.6.7 with Python 3.2 installed and I installed Activetcl 8.5.9 as recommended. IDLE is still crashing at random

threads with gtk gui problem

2011-05-14 Thread Andy Baxter
Hi, I'm working on adding a Gtk GUI to a python program. Its main function is to read raw data from an arduino board over USB, and convert it to MIDI note/controller events to be sent to another program. I've had it working fine with just a command line interface, but when I replaced the

Re: checking if a list is empty

2011-05-14 Thread Chris Angelico
On Sat, May 14, 2011 at 5:45 PM, rusi rustompm...@gmail.com wrote: And then we get the interesting result that (True = True) is False How does this work? In Python, the = sign is illegal there, and if you mean True == True, then it's True (obviously), which is not False. Chris Angelico --

Re: Converting a set into list

2011-05-14 Thread Ben Finney
TheSaint nob...@nowhere.net.no writes: Hello I've stumble to find a solution to get a list from a set code aa= ['a','b','c','f'] Creates a new list object. Binds the name ‘aa’ to that object. aa ['a', 'b', 'c', 'f'] Evaluates the object referenced by the name ‘aa’. set(aa) {'a',

Re: Converting a set into list

2011-05-14 Thread TheSaint
Peter Otten wrote: mylist = list(myset) Do you notice the similarity to converting a list to a set? There was something confusing me yesterday in doing that, but (for me strangely) I got cleared out. The point was that after a result from: newset= set(myset1) set(myset2) list= [newset]

Re: checking if a list is empty

2011-05-14 Thread David Robinow
On Fri, May 13, 2011 at 10:34 PM, Gregory Ewing greg.ew...@canterbury.ac.nz wrote: rusi wrote: Dijkstra's problem (paraphrased) is that python, by choosing the FORTRAN alternative of having a non-first-class boolean type, hinders scientific/mathematical thinking/progress. Python doesn't

Re: Converting a set into list

2011-05-14 Thread TheSaint
Ben Finney wrote: Another method to do what? Sorry, some time we expect to have said it as we thought it. The example was to show that after having made a set set(aa) the need to get that set converted into a list. My knowledge drove me to use a comprehension list as a converter. In another

Re: checking if a list is empty

2011-05-14 Thread Roy Smith
In article mailman.1549.1305383294.9059.python-l...@python.org, David Robinow drobi...@gmail.com wrote: On Fri, May 13, 2011 at 10:34 PM, Gregory Ewing greg.ew...@canterbury.ac.nz wrote: rusi wrote: Dijkstra's problem (paraphrased) is that python, by choosing the FORTRAN alternative of

Question about available python lib for a task

2011-05-14 Thread cesium5500
Hello, I would like to build a database of all the MS-Excel file on a LAN. I would like to get the files metadata : filename, summary, location, size, etc. Is there a dedicated python lib for the task? Is pywin32 one of the possible lib available? I would prefer to not building everything

Re: checking if a list is empty

2011-05-14 Thread rusi
On May 14, 6:42 pm, Chris Angelico ros...@gmail.com wrote: On Sat, May 14, 2011 at 5:45 PM, rusi rustompm...@gmail.com wrote: And then we get the interesting result that (True = True) is False How does this work? In Python, the = sign is illegal there, and if you mean True == True, then

Re: checking if a list is empty

2011-05-14 Thread Chris Angelico
On Sun, May 15, 2011 at 1:47 AM, rusi rustompm...@gmail.com wrote: So since [1,2,3] is one way of writing True (lets call it True3) and [1,2] is another (call it True2) then we have True3 == True2 is False But since according to Steven (according to Python?) True3 *is the same* as True2 we

Trace in a class

2011-05-14 Thread TheSaint
Hello, first of all, I'm a dummy in programming. My methods are just do-it-and-try- it. For more convinience I commonly using pdb myprogram and go with step-into and breakpoints. Lately I was setting a class, but it's incomplete and just calling it at the pdb prompt line I can't use breakpoints

Re: Get IP address of WIFI interface

2011-05-14 Thread Jun Hu
Thanks, is there any other way without using external command? On Fri, May 13, 2011 at 10:41 PM, Ishwor Gurung ishwor.gur...@gmail.comwrote: Hi. On 14 May 2011 14:46, Far.Runner far.run...@gmail.com wrote: Hi Python Experts: There are two network interfaces on my laptop, one is 100M

Re: Recursion or iteration (was Fibonacci series recursion error)

2011-05-14 Thread rusi
On May 14, 2:48 am, Mark Dickinson dicki...@gmail.com wrote: I don't see this (or Hans' version) as cheating at all. Yeah sure -- cheating is a strong word :-) This really *is* the power algorithm, just in a different number system from the usual one. Yes that was my point. If we take

Re: checking if a list is empty

2011-05-14 Thread rusi
On May 14, 8:55 pm, Chris Angelico ros...@gmail.com wrote: On Sun, May 15, 2011 at 1:47 AM, rusi rustompm...@gmail.com wrote: So since [1,2,3] is one way of writing True (lets call it True3) and [1,2] is another (call it True2) then we have True3 == True2 is False But since according

Re: Converting a set into list

2011-05-14 Thread Chris Angelico
On Sun, May 15, 2011 at 12:14 AM, TheSaint nob...@nowhere.net.no wrote: newset= set(myset1) set(myset2) list= [newset] [{'bla', 'alb', 'lab'}] Probably list(set) is not like [set]. list(set) creates a list out of the set. [set] creates a list with one element, the set itself. It's not a

Re: Python enabled gdb on Windows and relocation

2011-05-14 Thread Doug Evans
On Sat, May 14, 2011 at 2:09 AM, Ruben Van Boxem vanboxem.ru...@gmail.com wrote: 2011/5/14 Doug Evans d...@google.com: On Thu, May 12, 2011 at 9:19 AM, Ruben Van Boxem vanboxem.ru...@gmail.com wrote: (now in plain-text as required by gdb mailing list) Hi, I am currently trying to integrate

Re: Python enabled gdb on Windows and relocation

2011-05-14 Thread Doug Evans
On Sat, May 14, 2011 at 2:29 AM, Eli Zaretskii e...@gnu.org wrote: Date: Sat, 14 May 2011 11:09:13 +0200 From: Ruben Van Boxem vanboxem.ru...@gmail.com Cc: g...@sourceware.org, python-list@python.org 1. Check hardcoded path; my suggestion would be gdb executable/../lib/python27 2. If this

Re: Python enabled gdb on Windows and relocation

2011-05-14 Thread Doug Evans
On Sat, May 14, 2011 at 11:30 AM, Doug Evans d...@google.com wrote: Note that --exec-prefix is the runtime location of python. GCC uses this to tell libpython where to find its support files. [grep for Py_SetProgramName in gdb/python/python.c] Oops. s/GCC/GDB/ --

Re: threads with gtk gui problem

2011-05-14 Thread andy baxter
On 14/05/11 14:12, Andy Baxter wrote: Hi, I'm working on adding a Gtk GUI to a python program. Its main function is to read raw data from an arduino board over USB, and convert it to MIDI note/controller events to be sent to another program. I've had it working fine with just a command line

Re: threads with gtk gui problem

2011-05-14 Thread andy baxter
On 14/05/11 14:12, Andy Baxter wrote: Hi, I'm working on adding a Gtk GUI to a python program. Its main function is to read raw data from an arduino board over USB, and convert it to MIDI note/controller events to be sent to another program. I've had it working fine with just a command line

Re: turn monitor off and on

2011-05-14 Thread Terry Reedy
On 5/14/2011 3:20 AM, harrismh777 wrote: harrismh777 wrote: def turnOnMonitor(): SC_MONITORPOWER = 0xF170 win32gui.SendMessage(win32con.HWND_BROADCAST, win32con.WM_SYSCOMMAND, SC_MONITORPOWER, -1) I've never tried turning my monitor on/off without using my finger... The computer cannot

Re: How best to convert a string list to a python list

2011-05-14 Thread Terry Reedy
On 5/14/2011 4:41 AM, Nobody wrote: On Fri, 13 May 2011 10:15:29 -0700, noydb wrote: I want some code to take the items in a semi-colon-delimted string list and places each in a python list. I came up with below. In the name of learning how to do things properly, do you experts have a better

Re: unicode by default

2011-05-14 Thread Terry Reedy
On 5/14/2011 3:41 AM, harrismh777 wrote: Terry Reedy wrote: Easy, practical use of unicode is still a work in progress. Apparently... the good news for me is that SBL provides their unicode font here: http://www.sbl-site.org/educational/biblicalfonts.aspx I'm getting much closer here, but

Re: Question about available python lib for a task

2011-05-14 Thread Terry Reedy
On 5/14/2011 11:11 AM, cesium5...@yahoo.ca wrote: I would like to build a database of all the MS-Excel file on a LAN. I would like to get the files metadata : filename, summary, location, size, etc. You subject line is about a non-specific as can be, which means that the person who can

Re: checking if a list is empty

2011-05-14 Thread Terry Reedy
On 5/14/2011 3:39 AM, Steven D'Aprano wrote: Th money-quote as regards using arbitrary objects in truth tests: [quote] All this changed with the introduction of the two-element boolean domain {true, false} which provides the vocabulary needed to assign values to boolean

Re: checking if a list is empty

2011-05-14 Thread Terry Reedy
On 5/14/2011 3:45 AM, rusi wrote: (True = True) is False is a syntax error ;-) and 'True = True' is a (useless) statement, and statements do not have boolean values, and 'True == True' *is* True, which is to say, ((True == True) is False) is False. -- Terry Jan Reedy --

Re: Recursion or iteration (was Fibonacci series recursion error)

2011-05-14 Thread Ian Kelly
On Sat, May 14, 2011 at 11:24 AM, rusi rustompm...@gmail.com wrote: def fib(n):    if n==1 or n==2:        return 1    elif even(n):        return sq(fib (n//2)) + 2 * fib(n//2) * fib(n//2 - 1)    else:        return sq(fib (n//2 + 1)) + sq(fib(n // 2)) This is a strange algo  --

Re: checking if a list is empty

2011-05-14 Thread Terry Reedy
On 5/14/2011 1:43 PM, rusi wrote: But it seems you did not get the moral? Spelt out: Beware of lossy compression! [Which is also the moral of my 'proof'] I get it now. As I suggested in response to Stephen, [] and [1] spell False and True only in boolean contexts (if/while headers) where

Python drawing library?

2011-05-14 Thread OKB (not okblacke)
Is there any Python library for interactive drawing? I've done some googling but most searches for drawing lead me to libraries for programmatic creation of shapes on some GUI canvas. I'm looking for GUI widgets that allow the user to draw with the mouse, like a paint program, and

Re: Converting a set into list

2011-05-14 Thread Ben Finney
TheSaint nob...@nowhere.net.no writes: The example was to show that after having made a set set(aa) the need to get that set converted into a list. As pointed out: you already know how to create a set from an object; creating a list from an object is very similar: list(set(aa)) But

Re: checking if a list is empty

2011-05-14 Thread Ben Finney
rusi rustompm...@gmail.com writes: [Steven quote] In Python, [1, 2, 3] is another way of writing true, and [] is another way of writing false. Similarly with any other arbitrary objects. The only things that bools True and False are good for are: snipped [end Steven quote]

Re: unicode by default

2011-05-14 Thread Ben Finney
Terry Reedy tjre...@udel.edu writes: You need what is called, at least with Windows, an IME -- Input Method Editor. For a GNOME or KDE environment you want an input method framework; I recommend IBus URL:http://code.google.com/p/ibus/ which comes with the major GNU+Linux operating systems

I don't understand generator.send()

2011-05-14 Thread Victor Eijkhout
#! /usr/bin/env python def ints(): i=0 while True: yield i i += 1 gen = ints() while True: i = gen.next() print i if i==5: r = gen.send(2) print return:,r if i10: break I thought the send call would push the value 2 at the front of

Re: turn monitor off and on

2011-05-14 Thread harrismh777
Terry Reedy wrote: The computer cannot turn off the monitor. ... this was my point ;-) -- http://mail.python.org/mailman/listinfo/python-list

Re: I don't understand generator.send()

2011-05-14 Thread OKB (not okblacke)
Victor Eijkhout wrote: #! /usr/bin/env python def ints(): i=0 while True: yield i i += 1 gen = ints() while True: i = gen.next() print i if i==5: r = gen.send(2) print return:,r if i10: break I thought the send

Re: I don't understand generator.send()

2011-05-14 Thread Chris Angelico
On Sun, May 15, 2011 at 10:08 AM, Victor Eijkhout s...@sig.for.address wrote:        yield i        r = gen.send(2) When you send() something to a generator, it becomes the return value of the yield expression. See the example here:

Re: I don't understand generator.send()

2011-05-14 Thread Chris Rebert
On Sat, May 14, 2011 at 5:08 PM, Victor Eijkhout s...@sig.for.address wrote: #! /usr/bin/env python def ints():    i=0    while True:        yield i        i += 1 gen = ints() while True:    i = gen.next()    print i    if i==5:        r = gen.send(2)        print return:,r    if

Re: I don't understand generator.send()

2011-05-14 Thread Ian Kelly
On Sat, May 14, 2011 at 6:08 PM, Victor Eijkhout s...@sig.for.address wrote: I thought the send call would push the value 2 at the front of the queue. Instead it coughs up the 2, which seems senseless to me. 1/ How should I view the send call? I'm reading the manual and dont' get it There is

Re: I don't understand generator.send()

2011-05-14 Thread Ian Kelly
On Sat, May 14, 2011 at 6:47 PM, Chris Angelico ros...@gmail.com wrote: def ints():    i=0    queue=[]    while True:        if queue:  # see other thread, this IS legal and pythonic and quite sensible            sent=(yield queue.pop(0))        else:            sent=(yield i)            

Re: I don't understand generator.send()

2011-05-14 Thread Chris Angelico
On Sun, May 15, 2011 at 11:05 AM, Ian Kelly ian.g.ke...@gmail.com wrote: Actually, this won't work, because the value of the yield None gets ignored.  Thus if you try to call send() twice in a row, the generator the treats second send() as if it were a next(), and it is not possible to have

Re: I don't understand generator.send()

2011-05-14 Thread Victor Eijkhout
Chris Angelico ros...@gmail.com wrote: For what you're doing, there's a little complexity. If I understand, you want send() to be like an ungetc call... you could do that like this: def ints(): i=0 while True: sent=(yield i) if sent is not None: yield

Re: Converting a set into list

2011-05-14 Thread Chris Torek
In article 871v00j2bh@benfinney.id.au Ben Finney ben+pyt...@benfinney.id.au wrote: As pointed out: you already know how to create a set from an object; creating a list from an object is very similar: list(set(aa)) But why are you doing that? What are you trying to achieve? I have no

Re: checking if a list is empty

2011-05-14 Thread rusi
On May 15, 4:26 am, Ben Finney ben+pyt...@benfinney.id.au wrote: rusi rustompm...@gmail.com writes: [Steven quote] In Python, [1, 2, 3] is another way of writing true, and [] is another way of writing false. Similarly with any other arbitrary objects. The only things that bools True and

Re: PyPad 2.7.1 (Update 2)

2011-05-14 Thread Bill Allen
Jon, Looks very promising. Seems to be an issue with interactive mode. The following code behaves as thus: testvar=raw_input(enter value: ) print testvar When run, the prompt from raw_input does print to the output screen as: enter value: But when you tap in the lower window to enter the

Re: I don't understand generator.send()

2011-05-14 Thread Ian Kelly
On Sat, May 14, 2011 at 7:17 PM, Chris Angelico ros...@gmail.com wrote: You're right. It needs a while loop instead of the if (and some slight reordering): def ints():   i=0   queue=[]   while True:       if queue:  # see other thread, this IS legal and pythonic and quite sensible        

Re: Recursion or iteration (was Fibonacci series recursion error)

2011-05-14 Thread rusi
On May 15, 2:19 am, Ian Kelly ian.g.ke...@gmail.com wrote: On Sat, May 14, 2011 at 11:24 AM, rusi rustompm...@gmail.com wrote: def fib(n):    if n==1 or n==2:        return 1    elif even(n):        return sq(fib (n//2)) + 2 * fib(n//2) * fib(n//2 - 1)    else:        return sq(fib

Re: checking if a list is empty

2011-05-14 Thread Steven D'Aprano
On Sat, 14 May 2011 00:45:29 -0700, rusi wrote: On May 14, 12:39 pm, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: On Thu, 12 May 2011 23:46:12 -0700, rusi wrote: Mathematics has existed for millenia. Hindu-arabic numerals (base-10 numbers) have been known for about one

Re: checking if a list is empty

2011-05-14 Thread Steven D'Aprano
On Sat, 14 May 2011 19:41:32 -0700, rusi wrote: The python entities: {True, False} are not an exact (isomorphic) model for the semantic boolean domain {true, false} (which is needed for example to explicate the semantics of if while etc) Which is to say the boolean type in python is not

[issue11979] Minor improvements to the Sockets readme: typos, wording and sphinx features usage

2011-05-14 Thread Roundup Robot
Roundup Robot devnull@devnull added the comment: New changeset 4081f326e46c by Ezio Melotti in branch '2.7': #11979: improve wording and markup in sockets howto. Patch by Xavier Morel. http://hg.python.org/cpython/rev/4081f326e46c New changeset 85b9ad8b219b by Ezio Melotti in branch '3.1':

[issue11979] Minor improvements to the Sockets readme: typos, wording and sphinx features usage

2011-05-14 Thread Ezio Melotti
Ezio Melotti ezio.melo...@gmail.com added the comment: Fixed, thanks for the patches! -- assignee: docs@python - ezio.melotti resolution: - fixed stage: - committed/rejected status: open - closed versions: +Python 2.7, Python 3.1, Python 3.2 ___

[issue9516] sysconfig: $MACOSX_DEPLOYMENT_TARGET mismatch: now 10.3 but 10.5 during configure

2011-05-14 Thread Ronald Oussoren
Ronald Oussoren ronaldousso...@mac.com added the comment: Attached the backport to 2.7 for my v2 patch. -- Added file: http://bugs.python.org/file21997/issue9516-v2-python2.7.patch ___ Python tracker rep...@bugs.python.org

[issue6191] HTMLParser attribute parsing - 2 test cases when it fails

2011-05-14 Thread Ezio Melotti
Ezio Melotti ezio.melo...@gmail.com added the comment: What I described in my previous message is what Firefox does. If you think this should be changed, I suggest you to open another issue, possibly attaching a test case with the desired behavior and a patch to change it. --

[issue11981] dupe self.fp.tell() in zipfile.ZipFile.writestr

2011-05-14 Thread Ezio Melotti
Ezio Melotti ezio.melo...@gmail.com added the comment: I double checked the code on py3k and I think the second occurrence can be removed. -- nosy: +alanmcintyre versions: +Python 3.3 -Python 3.4 ___ Python tracker rep...@bugs.python.org

[issue12075] python3.2 memory leak when setting integer key in dictionary

2011-05-14 Thread kai zhu
New submission from kai zhu kai...@ugcs.caltech.edu: i'm using the latest debian unstable python3.2 build on colinux (2011, may, 14) ## leak.py ## import imp, leak; imp.reload(leak) ## will leak ~2.5mb per reload ## on i386 debian unstable machine (according to top). ## in my real world app

[issue12071] test_concurrent_futures.test_context_manager_shutdown() hangs on OpenIndiana

2011-05-14 Thread Charles-François Natali
Charles-François Natali neolo...@free.fr added the comment: This makes sense. I was suspecting a system limit exhaustion, maybe OOM or maximum number of threads, something like that. But at least on Linux, in OOM condition, the process would either get nuked by the OOM-killer, or

[issue12075] python3.2 memory leak when setting integer key in dictionary

2011-05-14 Thread Ezio Melotti
Ezio Melotti ezio.melo...@gmail.com added the comment: I think this has to do with class attributes and reload(): wolf@hp:~/dev/py/py3k$ cat leak.py class Foo: pass Foo.l = list(range(65535)) wolf@hp:~/dev/py/py3k$ ./python Python 3.3a0 (default:4b122cac7ac5+, May 14 2011, 10:01:13) [GCC

[issue12075] python3.2 memory leak when setting integer key in dictionary

2011-05-14 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc amaur...@gmail.com added the comment: It's simply because all classes form a cycle (Foo - Foo.__mro__ - Foo) A class and class attributes can only be freed with gc.collect(). Did you disable the garbage collector? -- nosy: +amaury.forgeotdarc

[issue6721] Locks in python standard library should be sanitized on fork

2011-05-14 Thread Charles-François Natali
Charles-François Natali neolo...@free.fr added the comment: Hello Steffen, First, thanks for testing this on OS-X: I only have access to Linux systems (I tested both the semaphore and the emulated semaphore paths). If I understand correctly, the patch works fine with the default build option

[issue12076] IDLE v.3.2 crashing randomly on MacOSX 10.6.7

2011-05-14 Thread Chris Paton
New submission from Chris Paton chrispaton2...@gmail.com: I don't know much about Python (in fact, I'm a noob) so not understanding much of the technical lingo. I've installed Python 3.2, and Active TCL 8.5.9 on my machine. IDLE crashes at random points - compiling, saving, loading or even

[issue12076] IDLE v.3.2 crashing randomly on MacOSX 10.6.7

2011-05-14 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc amaur...@gmail.com added the comment: Hello, The Python issue tracker is not here to get help. You will have better answers from friendly people if you ask your question on the comp.lang.python newsgroup, or the python-list mailing list:

[issue9205] Parent process hanging in multiprocessing if children terminate unexpectedly

2011-05-14 Thread Charles-François Natali
Charles-François Natali neolo...@free.fr added the comment: Indeed, it isn't, Pipe objects are not meant to be safe against multiple access. Queue objects (in multiprocessing/queues.py) use locks so they are safe. But if the write to the Pipe is not atomic, then the select isn't safe. select

[issue7960] test.support.captured_output has invalid docstring example

2011-05-14 Thread Roundup Robot
Roundup Robot devnull@devnull added the comment: New changeset ec35f86efb0d by Ezio Melotti in branch 'default': Merge with 3.2 and also remove captured_output from __all__ (see #7960). http://hg.python.org/cpython/rev/ec35f86efb0d -- ___ Python

[issue7960] test.support.captured_output has invalid docstring example

2011-05-14 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7960 ___ ___

[issue12050] unconsumed_tail of zlib.Decompress is not always cleared on decompress() call

2011-05-14 Thread Roundup Robot
Roundup Robot devnull@devnull added the comment: New changeset 6a45567c7245 by Nadeem Vawda in branch '3.1': Issue #12050: zlib.decompressobj().decompress() now clears the unconsumed_tail http://hg.python.org/cpython/rev/6a45567c7245 New changeset 49c998a88777 by Nadeem Vawda in branch '3.2':

[issue12050] unconsumed_tail of zlib.Decompress is not always cleared on decompress() call

2011-05-14 Thread Roundup Robot
Roundup Robot devnull@devnull added the comment: New changeset 24543f7a87ce by Nadeem Vawda in branch '2.7': Issue #12050: zlib.decompressobj().decompress() now clears the unconsumed_tail http://hg.python.org/cpython/rev/24543f7a87ce -- ___ Python

[issue12050] unconsumed_tail of zlib.Decompress is not always cleared on decompress() call

2011-05-14 Thread Nadeem Vawda
Nadeem Vawda nadeem.va...@gmail.com added the comment: The code has been fixed. Once again, thanks for the bug report. -- resolution: - fixed stage: needs patch - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org

[issue11610] Improving property to accept abstract methods

2011-05-14 Thread Darren Dale
Darren Dale dsdal...@gmail.com added the comment: Is there anything preventing this patch from being merged? -- nosy: +Darren.Dale ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11610 ___

[issue12077] Harmonizing descriptor protocol documentation

2011-05-14 Thread Davide Rizzo
New submission from Davide Rizzo sor...@gmail.com: There are three sources of information for the descriptor protocol: - Data model reference (Doc/reference/datamodel.rst) - Descriptor HowTo guide (Doc/howto/descriptor.rst) - PEP 252 A developer who already knows descriptor tipically reads the

[issue12078] re.sub() replaces only several matches

2011-05-14 Thread Andriy Rysin
Changes by Andriy Rysin ary...@gmail.com: -- components: Regular Expressions files: repl.sh nosy: arysin priority: normal severity: normal status: open title: re.sub() replaces only several matches versions: Python 3.1 Added file: http://bugs.python.org/file21999/repl.sh

  1   2   >