Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-03-22 Thread Ian Kelly
On Sat, Mar 22, 2014 at 9:16 PM, Rustom Mody wrote: > [I am not completely sure whether the following can be proved/is true] > > 1. One can change lambda's closure rules which would amount to > "significant complexity for relatively little gain" > > 2. One can change comprehension rules to not rea

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-03-22 Thread Rustom Mody
On Sunday, March 23, 2014 8:16:28 AM UTC+5:30, Ian wrote: > On Sat, Mar 22, 2014 at 6:32 PM, Rhodri James wrote: > > wrote: > >> Well almost... > >> Except that the 'loop' I am talking of is one of > >> def loop(): > >> return [yield (lambda: x) for x in [1,2,3]] > >> or > >> return (yiel

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-03-22 Thread Ian Kelly
On Sat, Mar 22, 2014 at 6:32 PM, Rhodri James wrote: > On Sat, 22 Mar 2014 05:26:26 -, Rustom Mody > wrote: > >> Well almost... >> Except that the 'loop' I am talking of is one of >> def loop(): >> return [yield (lambda: x) for x in [1,2,3]] >> or >> return (yield (lambda: x) for x

Re: Reading in cooked mode (was Re: Python MSI not installing, log file showing name of a Viatnemese communist revolutionary)

2014-03-22 Thread Cameron Simpson
On 23Mar2014 12:37, Chris Angelico wrote: > On Sun, Mar 23, 2014 at 12:07 PM, Steven D'Aprano > wrote: > > On Sun, 23 Mar 2014 02:09:20 +1100, Chris Angelico wrote: > >> On Sun, Mar 23, 2014 at 1:50 AM, Steven D'Aprano > >> wrote: > >>> Line endings are terminators: they end the line. Whether yo

Re: Question about Source Control

2014-03-22 Thread Dave Angel
Albert-Jan Roskam Wrote in message: > In addition to posting in html format, you have also set the font size too small for me to easily read. Reason number 12 for posting in text mode in a text newsgroup. -- DaveA -- https://mail.python.org/mailman/listinfo/python-list

Reading in cooked mode (was Re: Python MSI not installing, log file showing name of a Viatnemese communist revolutionary)

2014-03-22 Thread Chris Angelico
On Sun, Mar 23, 2014 at 12:07 PM, Steven D'Aprano wrote: > On Sun, 23 Mar 2014 02:09:20 +1100, Chris Angelico wrote: > >> On Sun, Mar 23, 2014 at 1:50 AM, Steven D'Aprano >> wrote: >>> Line endings are terminators: they end the line. Whether you consider >>> the terminator part of the line or not

Re: Python MSI not installing, log file showing name of a Viatnemese communist revolutionary

2014-03-22 Thread Steven D'Aprano
On Sun, 23 Mar 2014 02:09:20 +1100, Chris Angelico wrote: > On Sun, Mar 23, 2014 at 1:50 AM, Steven D'Aprano > wrote: >> Line endings are terminators: they end the line. Whether you consider >> the terminator part of the line or not is a matter of opinion (is the >> cover of a book part of the bo

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-03-22 Thread Rhodri James
On Sat, 22 Mar 2014 05:26:26 -, Rustom Mody wrote: Well almost... Except that the 'loop' I am talking of is one of def loop(): return [yield (lambda: x) for x in [1,2,3]] or return (yield (lambda: x) for x in [1,2,3]) or just plain ol (lambda x: for x in [1,2,3]) IOW loop

RICHARD LEAKEY RECENTLY ARRESTED -- THE THRINAXODON TIMES REPORTS YOU CRAP, YOU CALL OUT BULLSHIT!

2014-03-22 Thread SUPER THRINAXODON DUMBASS
>LOOK, MOM! A BIRD, A PLANE, A THRINAXODON! > RICHARD LEAKEY WAS RECENTLY ARRESTED IN CONNECTION TO EVOLUTIONARY SCANDALS. > THRINAXODON CAUGHT THE WHOLE SCENE! > ONLY ONE GUESS TO WHAT RICHARD LEAKEY WAS UP TO WILL SHUT YOUR MOUTHS! > RICHARD LEAKEY WAS B

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-03-22 Thread vasudevram
Thanks to all those who answered. - Vasudev -- https://mail.python.org/mailman/listinfo/python-list

Help needed to create a Python extension library for an existing shared memory hash table library

2014-03-22 Thread Simon Hardy-Francis
Hi Python fans, I just released my first open source project ever called SharedHashFile [1]. It's a shared memory hash table written in C. Some guy on Quora asked [2] whether there's an extension library for Python coming out. I would like to do one but I know little about Python. I was wonderin

Re: terminate a program gracefully from a thread

2014-03-22 Thread Terry Reedy
On 3/22/2014 8:40 AM, Jabba Laci wrote: I have a script (see below) that I want to terminate after X seconds. The main loop of the program is waiting for user input. The program enters the main loop and I try to shut down the program after X seconds from a thread but I can't figure out how to do

Re: newbie - Does IDLE care about sitecustomize.py?

2014-03-22 Thread Terry Reedy
On 3/22/2014 9:41 AM, vikram.deni...@gmail.com wrote: Could you figure this out? On Wednesday, November 16, 2005 10:37:09 PM UTC+8, bobu...@yahoo.com wrote: I have the following test script in the file customize.py # C:\Python24\Lib\site-packages\sitecustomize.py print "test text from sitecust

Re: Question about Source Control

2014-03-22 Thread Albert-Jan Roskam
Hi, I can recommend the book "Pragmatic Guide to Git". Very practical and to the point: http://www.amazon.com/Pragmatic-Guide-Git-Programmers/dp/1934356727/ref=sr_1_1/184-0142481-0484062?ie=UTF8&qid=1395518159&sr=8-1&keywords=pragmatic+guide+to+git I addition, I read a big fat super-exhaustive

Re: Question about Source Control

2014-03-22 Thread Tim Chase
On 2014-03-22 17:32, Albert van der Horst wrote: > >I don't know if this is a hg-vs-git way of thinking, but I tend to > >frequently commit things on a private development branch regardless > >of brokenness, but once I get it working, I flatten & clean up > >those changes ("rebase" in git terms, wh

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-03-22 Thread Rustom Mody
The foll is fairly standard fare in denotational semantics -- please excuse the length! In order to understand (formally) the concept of 'variable' we need to have at the least a concept of name(or identifier) -> value mapping. This mapping is called an 'environment' If we stop at that we get the

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-03-22 Thread Marko Rauhamaa
Mark Lawrence : > On 22/03/2014 09:09, Ian Kelly wrote: >> Because Python as a language only has the concept of assignment, not >> binding. I think it would be weird and confusing if variables worked >> this way in comprehensions and nowhere else. > > My understanding has always been that an expre

RE: Controlling buffer alignment in file.read()

2014-03-22 Thread Laurent Pointal
Haralanov, Mitko wrote: >> For control at that level you'd be better off using >> direct system calls, i.e. os.open() and os.read(), >> then you can read exacty the number of bytes you want. >> > > The problem is not controlling the number of bytes read. That part seems > to be working. The issu

Re: Question about Source Control

2014-03-22 Thread Albert van der Horst
In article , Gregory Ewing wrote: >Chris Angelico wrote: >> You can then offer a non-source-control means of downloading that >> specific revision. > >Just keep in mind the downside that you can't then >push or pull your changes directly back into the main >repository. You can generate a patch fi

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-03-22 Thread Mark Lawrence
On 22/03/2014 09:09, Ian Kelly wrote: On Fri, Mar 21, 2014 at 8:06 PM, Rustom Mody wrote: Two: A comprehension variable is not bound but reassigned across the comprehension. This problem remains in python3 and causes weird behavior when lambdas are put in a comprehension Because Python as a l

Re: Question about Source Control

2014-03-22 Thread Albert van der Horst
In article , Tim Chase wrote: >On 2014-03-18 21:38, Terry Reedy wrote: >> At least with hg, one should best test the code in the working >> directory *before* committing to the local repository. > >I don't know if this is a hg-vs-git way of thinking, but I tend to >frequently commit things on a p

Re: Python - Caeser Cipher Not Giving Right Output

2014-03-22 Thread Rustom Mody
On Saturday, March 22, 2014 7:52:28 PM UTC+5:30, Ian wrote: > On Mar 20, 2014 9:59 PM, "Dave Angel" wrote: > >  dtra...@gmail.com Wrote in message: > > > And I was wondering how I would add the partenthesis because I tried: > > > return numtochar(c1 + c2 (%26)) and it gave me an error. > > Please

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-03-22 Thread Rustom Mody
On Saturday, March 22, 2014 2:39:56 PM UTC+5:30, Ian wrote: > On Fri, Mar 21, 2014 at 8:06 PM, Rustom Mody wrote: > > Two: A comprehension variable is not bound but reassigned across the > > comprehension. This problem remains in python3 and causes weird behavior > > when > > lambdas are put in a

Re: Python MSI not installing, log file showing name of a Viatnemese communist revolutionary

2014-03-22 Thread Chris Angelico
On Sun, Mar 23, 2014 at 1:50 AM, Steven D'Aprano wrote: > Line endings are terminators: they end the line. Whether you consider the > terminator part of the line or not is a matter of opinion (is the cover > of a book part of the book?) but consider this: > > If you say that the end of lines a

Re: Python MSI not installing, log file showing name of a Viatnemese communist revolutionary

2014-03-22 Thread Steven D'Aprano
On Fri, 21 Mar 2014 22:58:37 -0500, Mark H Harris wrote: > I notice (since moving my stuff to Thunderbird two weeks back) the > double spacing you keep squawking about, but I don't find it the big > nuisance you're talking about; ok, so we have to scroll a bit further. It's not the scrolling that

Re:User prompt as file to read

2014-03-22 Thread Dave Angel
kjaku...@gmail.com Wrote in message: > I'm trying to create a program that will prompt the user for a list of text > files to read from, then read those text files and build a dictionary of all > the unique words found. Then finally put those unique words into another file > and make it alphabe

Re: Python - Caeser Cipher Not Giving Right Output

2014-03-22 Thread Ian Kelly
On Mar 20, 2014 9:59 PM, "Dave Angel" wrote: > > dtran...@gmail.com Wrote in message: > > And I was wondering how I would add the partenthesis because I tried: > > > > return numtochar(c1 + c2 (%26)) and it gave me an error. > > Please help us to help you by actually showing the traceback. > Doe

User prompt as file to read

2014-03-22 Thread kjakupak
I'm trying to create a program that will prompt the user for a list of text files to read from, then read those text files and build a dictionary of all the unique words found. Then finally put those unique words into another file and make it alphabetical order. What I've got: import string s

Re: newbie - Does IDLE care about sitecustomize.py?

2014-03-22 Thread Chris Angelico
On Sun, Mar 23, 2014 at 12:41 AM, wrote: > Could you figure this out? > > On Wednesday, November 16, 2005 10:37:09 PM UTC+8, bobu...@yahoo.com wrote: >> [ chomp ] You're responding to a decade-old post, you're posting from Google Groups, and you haven't added any information to the thread at all

Re: newbie - Does IDLE care about sitecustomize.py?

2014-03-22 Thread vikram . denizen
Could you figure this out? On Wednesday, November 16, 2005 10:37:09 PM UTC+8, bobu...@yahoo.com wrote: > I have the following test script in the file customize.py > > # C:\Python24\Lib\site-packages\sitecustomize.py > print "test text from sitecustomize" > > If start Python from command prompt I

Re: terminate a program gracefully from a thread

2014-03-22 Thread Chris Angelico
On Sun, Mar 23, 2014 at 12:18 AM, Dave Angel wrote: > Alternatively, rethink the need to preload at boot time. Any > caching the OS does is likely to only last a few minutes, > depending on load. So maybe you can make the real load seem to be > quicker by displaying the gui right away, but d

Re: terminate a program gracefully from a thread

2014-03-22 Thread Jabba Laci
> You need a flag to indicate that a particular invocation is the > dummy one (background). So use that same flag either to suppress > starting the thread, or to avoid the unwanted raw_input. > > Alternatively, rethink the need to preload at boot time. Any > caching the OS does is likely to o

Re:terminate a program gracefully from a thread

2014-03-22 Thread Dave Angel
Jabba Laci Wrote in message: > Hi, > > I have a script (see below) that I want to terminate after X seconds. > The main loop of the program is waiting for user input. > The program enters the main loop and I try to shut down the program > after X seconds from a thread but I can't figure out how

terminate a program gracefully from a thread

2014-03-22 Thread Jabba Laci
Hi, I have a script (see below) that I want to terminate after X seconds. The main loop of the program is waiting for user input. The program enters the main loop and I try to shut down the program after X seconds from a thread but I can't figure out how to do it. The program should also do some c

Re: help with for loop----python 2.7.2

2014-03-22 Thread Ian Kelly
On Sat, Mar 22, 2014 at 5:21 AM, wrote: > I am trying to get all the element data from the rss below. > The only thing I am pulling is the first element. > I don't understand why the for loop does not go through the entire rss. > Here is my code [SNIP] > for item in soup.find_all('item'): >

Re: Installing ssdeep on Portable Python /advice

2014-03-22 Thread laguna-mc
http://ssdeep.sourceforge.net/usage.html the installation described in aboved document is for Linux only. Well, I need experiment and see errors. Regards, > - Original Message - > From: Mark H Harris > Sent: 03/22/14 05:32 AM > To: python-list@python.org > Subject: Re: Installing ssdeep

help with for loop----python 2.7.2

2014-03-22 Thread teddybubu
I am trying to get all the element data from the rss below. The only thing I am pulling is the first element. I don't understand why the for loop does not go through the entire rss. Here is my code try: from urllib2 import urlopen except ImportError: from urllib.request import urlopen

Re: Python MSI not installing, log file showing name of a Viatnemese communist revolutionary

2014-03-22 Thread cool-RR
On Saturday, March 22, 2014 3:39:21 AM UTC+2, Terry Reedy wrote: > Does your .b2 install work? Can you delete it thru the programs list? I uninstalled it before this entire adventure. -- https://mail.python.org/mailman/listinfo/python-list

Re: Python MSI not installing, log file showing name of a Viatnemese communist revolutionary

2014-03-22 Thread Mark Lawrence
On 22/03/2014 08:54, wxjmfa...@gmail.com wrote: Le samedi 22 mars 2014 05:59:34 UTC+1, Mark H. Harris a écrit : On 3/21/14 11:46 PM, Chris Angelico wrote: (Side point: You have your 0d and your 0a backwards; the Unix line ending is U+000A, and the Windows default is U+000D U+000A.)

Re: Python MSI not installing, log file showing name of a Viatnemese communist revolutionary

2014-03-22 Thread Mark Lawrence
On 22/03/2014 03:58, Mark H Harris wrote: On 3/21/14 5:44 PM, Mark Lawrence wrote: I'm pleased to see that you have answers. In return would you either use the mailing list https://mail.python.org/mailman/listinfo/python-list or read and action this https://wiki.python.org/moin/GoogleGroupsPytho

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-03-22 Thread Mark Lawrence
On 22/03/2014 02:06, Rustom Mody wrote: The same in haskell: Prelude> let fl = [\ y -> x + y | x <- [1,2,3]] Prelude> [(fl!!i) 0 | i<- [0,1,2]] [1,2,3] My really big complaint about Python is that it's nothing like CORAL 66. I think I'll raise this on python ideas in an attempt to get this

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-03-22 Thread Marko Rauhamaa
Ian Kelly : > You can get the desired effect by adding a layer of indirection: > fl = [(lambda x: lambda y: x+y)(x) for x in [1,2,3]] A trick to remember! Variable lifetime reduction by function invocation. Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-03-22 Thread Marko Rauhamaa
Steven D'Aprano : > This makes perfect sense: by the time you call the functions, the name x > has been rebound to the value 3. > [...] > Now I'm not sure precisely how Haskell implements this trick, but it > suggests to me that it creates a different closure each time around > the loop of the

Re: Github down?

2014-03-22 Thread Gregory Ewing
Dan Sommers wrote: On Fri, 21 Mar 2014 14:51:54 +0100, Chris “Kwpolska” Warrick wrote: (though GitHub could qualify as social media for some…) +1 QOTW https://xkcd.com/624/ -- https://mail.python.org/mailman/listinfo/python-list

Re: Python MSI not installing, log file showing name of a Viatnemese communist revolutionary

2014-03-22 Thread Terry Reedy
On 3/22/2014 5:50 AM, Steven D'Aprano wrote: On Sat, 22 Mar 2014 01:24:33 -0400, Terry Reedy wrote: If I were in charge of the software used for this list, I would replace Mark with a custom addition to return mis-formated posts (more blank lines than not) with instructions on how to fix them.

Re: Python MSI not installing, log file showing name of a Viatnemese communist revolutionary

2014-03-22 Thread Steven D'Aprano
On Sat, 22 Mar 2014 01:24:33 -0400, Terry Reedy wrote: > On 3/22/2014 12:30 AM, Mark H Harris wrote: >> On 3/21/14 11:15 PM, Chris Angelico wrote: >>> It compounds. One reply makes for double spacing... two makes >>> quadruple, three means we have seven wasted lines between every pair >>> of real

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-03-22 Thread Steven D'Aprano
On Fri, 21 Mar 2014 23:51:38 -0500, Mark H Harris wrote: > Lambda is a problem, if only because it causes confusion. What's the > problem? Glad you asked. The constructs DO NOT work the way most people > would expect them to, having limited knowledge of python! Why is that a problem? Would you c

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-03-22 Thread Ian Kelly
On Fri, Mar 21, 2014 at 8:06 PM, Rustom Mody wrote: > Two: A comprehension variable is not bound but reassigned across the > comprehension. This problem remains in python3 and causes weird behavior when > lambdas are put in a comprehension Because Python as a language only has the concept of assi

Re: Python MSI not installing, log file showing name of a Viatnemese communist revolutionary

2014-03-22 Thread wxjmfauth
Le samedi 22 mars 2014 05:59:34 UTC+1, Mark H. Harris a écrit : > On 3/21/14 11:46 PM, Chris Angelico wrote: > > > (Side point: You have your 0d and your 0a backwards; the Unix line > > > ending is U+000A, and the Windows default is U+000D U+000A.) > > > > Yeah, I know... smart apple. > >

which async framework? - a summary

2014-03-22 Thread Chris Withers
On 14/03/2014 00:36, Tim Chase wrote: On 2014-03-14 00:25, Chris Withers wrote: I've been pleasantly surprised by the succinct, well reasoned and respectful replies from each of the communities! As one who doesn't lurk on the other lists, is there a nice executive summary of their responses?

Re: Problem with pickle and restarting a program

2014-03-22 Thread dieter
peace writes: > On Thursday, March 20, 2014 1:20:03 AM UTC-7, dieter wrote: > ... >> You may want to use debugging to determine what goes on in detail. > ... > I tried doing that. I still could not figure out what was wrong. Thank you. Debugging is often not easy. An essential strategy is "divide