Re: which library has map reduce and how to use it for this case

2016-06-10 Thread meInvent bbird
there are six operator, and a logic table initial in b variable aa[b[j][i]] [aa[b[i][0:1]+b[i][2:3] are just like vlookup to find output of each operator acting on first column and second column, second column and third column , first column and third column and searching a output columns

Re: how to solve memory

2016-06-10 Thread meInvent bbird
i use sage cloud to run, it killed my program i checked total memory is large, how much memory it need, 8GB*10, 80GB? top - 05:55:16 up 10:05, 1 user, load average: 0.35, 0.63, 0.56 Tasks: 13 total, 1 running, 12 sleeping, 0 stopped, 0 zombie %Cpu(s): 0.5 us, 0.4 sy, 0.0 ni, 99.1 id,

Re: how to solve memory

2016-06-10 Thread meInvent bbird
i use a version having better indentation, and then remove redundant which if sum column == 54 , do not add this column into initlist and add deep > 0 before recursive call and print number of initlist is 118,XXX but it is still running, where it run , and why run a very long time def DFS(b, de

Re: how to solve memory

2016-06-10 Thread meInvent bbird
this time i remove redundant which not add full column sum already has beeb 27*2 but it always has syntax error, indentation error, where is wrong? def DFS(b, deep, maxx, sourceoperators, path): initlist = [] if deep > 0: print("deep=", deep) for aa,bb in itertools.combinations(sourceoper

Re: i'm a python newbie & wrote my first script, can someone critique it?

2016-06-10 Thread Matt Wheeler
First of all welcome :) The other suggestions you've received so far are good so I won't repeat them... (note that in particular I've reused the names you've chosen in your program where I've given code examples, but that's purely for clarity and I agree with the others who've said you should use

Re: i'm a python newbie & wrote my first script, can someone critique it?

2016-06-10 Thread Larry Hudson via Python-list
On 06/10/2016 03:52 PM, mad scientist jr wrote: Is this group appropriate for that kind of thing? (If not sorry for posting this here.) So I wanted to start learning Python, and there is s much information online, which is a little overwhelming. I really learn best from doing, especially i

Re: fast dictionary initialization

2016-06-10 Thread Tim Chase
On 2016-06-10 14:07, maurice wrote: > example: > valuesList = [1,2,3] > keysList = ['1','2','3'] > > So the dictionary can basically convert string to int: > > dictionary = {'1':1, '2':2, '3':3} A couple similar options: The most straightforward translation of your description: opt1 = dic

Re: for / while else doesn't make sense

2016-06-10 Thread Gregory Ewing
Steven D'Aprano wrote: I have a 2000 inch monitor, and by using a narrow proportional font set to 5pt, I can display the entire Python standard library including tests on screen at once. Then it's just a matter of using my trusty 4" reflecting telescope to zoom in on any part of the screen I like

Re: Want to play with or learn a parser system including a grammar for Python? See spark_parser on pypy

2016-06-10 Thread rocky
On Thursday, June 9, 2016 at 1:36:56 AM UTC-4, Lawrence D’Oliveiro wrote: > On Wednesday, June 8, 2016 at 10:39:00 PM UTC+12, rocky wrote: > > > In addition to the example programs which give the classic arithmetic > > expression evaluator, I now include the beginnings of a full Python 2.6 > > lan

Re: i'm a python newbie & wrote my first script, can someone critique it?

2016-06-10 Thread Joel Goldstick
On Fri, Jun 10, 2016 at 6:52 PM, mad scientist jr wrote: > Is this group appropriate for that kind of thing? > (If not sorry for posting this here.) > > So I wanted to start learning Python, and there is s much information > online, which is a little overwhelming. I really learn best from doi

Re: Want to play with or learn a parser system including a grammar for Python? See spark_parser on pypy

2016-06-10 Thread rocky
On Friday, June 10, 2016 at 4:33:28 AM UTC-4, Robin Becker wrote: > On 08/06/2016 19:32, rocky wrote: > .. > > > > Sorry that should have been 1998 which would make more sense for the 7th > > conference if the 1st one was around 2001. I've corrected the date in [1] > > https://pypi.pytho

Re: i'm a python newbie & wrote my first script, can someone critique it?

2016-06-10 Thread Marc Brooks
The structure of your program is really not that Pythonic. I'd recommend you take a look at PEP 8. https://www.python.org/dev/peps/pep-0008/ It's not perfect, but it's a good start to get a feel for how to structure your Python work. Marc On Fri, Jun 10, 2016 at 7:05 PM, Christopher Reimer < c

Re: how to solve memory

2016-06-10 Thread MRAB
On 2016-06-11 00:31, meInvent bbird wrote: it is quite ridiculous, this time i am sure that i put correct indentation and add a else statement to make sure recursive call inside the if statement , it still memory error, where is the memory error? is itertools.combinations so big for the list?

Re: i'm a python newbie & wrote my first script, can someone critique it?

2016-06-10 Thread Christopher Reimer
Sent from my iPhone > On Jun 10, 2016, at 3:52 PM, mad scientist jr > wrote: > . > Now that it's done, I am wondering what kind of things I could do better. This is Python, not BASIC. Lay off on the CAP LOCK key and delete all the comments and separation blocks. No one is going to find your

Re: how to solve memory

2016-06-10 Thread meInvent bbird
it is quite ridiculous, this time i am sure that i put correct indentation and add a else statement to make sure recursive call inside the if statement , it still memory error, where is the memory error? is itertools.combinations so big for the list? if deep == maxx: if deep > 0: b

Re: how to solve memory

2016-06-10 Thread meInvent bbird
i put final part of code inside one more space and add constraint deep > 0 but still memory error and print the deep number to see, it do not run infinity again V6 is just my superstitution, because V is disable 6 is separation i run your version directly, it has key = '0' error M1 = {}

i'm a python newbie & wrote my first script, can someone critique it?

2016-06-10 Thread mad scientist jr
Is this group appropriate for that kind of thing? (If not sorry for posting this here.) So I wanted to start learning Python, and there is s much information online, which is a little overwhelming. I really learn best from doing, especially if it's something actually useful. I needed to cre

Re: movie from pictures

2016-06-10 Thread alex wright
I find shlex.split to be most useful to make my arguments a list in these cases. On Jun 9, 2016 3:28 PM, "MRAB" wrote: > On 2016-06-09 19:58, Peter Otten wrote: > >> Nev wrote: >> >> Thank you for your reply. I tried something like this in python code: >>> >>> from subprocess import call >>> call

Re: fast dictionary initialization

2016-06-10 Thread Random832
pOn Fri, Jun 10, 2016, at 17:07, maurice wrote: > Hi. If I have already a list of values, let's call it valuesList and the > keysList, both same sized lists, what is the easiest/quickest way to > initialize a dictionary with those keys and list, in terms of number of > lines perhaps? > > example:

fast dictionary initialization

2016-06-10 Thread maurice
Hi. If I have already a list of values, let's call it valuesList and the keysList, both same sized lists, what is the easiest/quickest way to initialize a dictionary with those keys and list, in terms of number of lines perhaps? example: valuesList = [1,2,3] keysList = ['1','2','3'] So the di

Re: how to solve memory

2016-06-10 Thread John Gordon
In <8a1c372e-bd6c-4923-8ae1-8f129ec74...@googlegroups.com> meInvent bbird writes: > > I already responded to your earlier post about this program. Did you > > read it? > sorry i missed your reply post, > i find post by me and search your name, no this name > is your name changed in previous p

Re: for / while else doesn't make sense

2016-06-10 Thread Marko Rauhamaa
Ian Kelly : > On Jun 10, 2016 6:37 AM, "Marko Rauhamaa" wrote: >> If your display can show 1,500 lines at once, that's your limit. Mine >> shows 70. > > I disagree on that point. For a typical-size display, it's a > reasonable guideline. The point I'm making is that if I'm accusing you for writi

Re: how to solve memory

2016-06-10 Thread meInvent bbird
On Friday, June 10, 2016 at 10:08:44 PM UTC+8, Steven D'Aprano wrote: > On Fri, 10 Jun 2016 10:58 am, meInvent bbird wrote: > > [snip unreadable code] > > I just ran your code, and it almost crashed my computer. I think it is quite > rude to post code without an explanation of what the problem is

Re: how to solve memory

2016-06-10 Thread meInvent bbird
On Friday, June 10, 2016 at 10:46:43 PM UTC+8, John Gordon wrote: > In <4f853aa2-cc00-480b-9fd7-79b05cbd4...@googlegroups.com> meInvent bbird > writes: > > > https://drive.google.com/file/d/0Bxs_ao6uuBDULVNsRjZSVjdPYlE/view?usp=sharing > > I already responded to your earlier post about this pro

Re: how to solve memory

2016-06-10 Thread meInvent bbird
i put final part of code inside one more space and add constraint deep > 0 but still memory error and print the deep number to see, it do not run infinity again V6 is just my superstitution, because V is disable 6 is separation i run your version directly, it has key = '0' error M1 = {} M2 = {

Re: run code error with numpy and scipy

2016-06-10 Thread meInvent bbird
On Thursday, June 9, 2016 at 9:52:43 PM UTC+8, MRAB wrote: > On 2016-06-09 07:02, meInvent bbird wrote: > > when i run code in window has an error not a valid win32 dll > > > > then i install scipy first in this site, then install numpy-mkl > > all python 2.7 and win32 > > > > http://www.lfd.uci.ed

Re: how to solve memory

2016-06-10 Thread John Gordon
In <4f853aa2-cc00-480b-9fd7-79b05cbd4...@googlegroups.com> meInvent bbird writes: > https://drive.google.com/file/d/0Bxs_ao6uuBDULVNsRjZSVjdPYlE/view?usp=sharing I already responded to your earlier post about this program. Did you read it? -- John Gordon A is for Amy, who f

Almost crashing computer, was Re: how to solve memory

2016-06-10 Thread Peter Otten
Steven D'Aprano wrote: > I just ran your code, and it almost crashed my computer. When you suspect that a script may consume a lot of memory (the subject might have been a hint) ulimit (bash internal) helps you prevent that your linux machine becomes unresponsive. $ ulimit -v 20 $ pytho

Re: for / while else doesn't make sense

2016-06-10 Thread Steven D'Aprano
On Sat, 11 Jun 2016 12:00 am, Ian Kelly wrote: > On Jun 10, 2016 6:37 AM, "Marko Rauhamaa" wrote: >> If your display can show 1,500 lines at once, that's your limit. Mine >> shows 70. > > I disagree on that point. For a typical-size display, it's a reasonable > guideline. But just because your

Re: how to solve memory

2016-06-10 Thread Steven D'Aprano
On Fri, 10 Jun 2016 10:58 am, meInvent bbird wrote: [snip unreadable code] I just ran your code, and it almost crashed my computer. I think it is quite rude to post code without an explanation of what the problem is. I'm afraid that your code is virtually unreadable to me. It is too verbose, th

Re: which library has map reduce and how to use it for this case

2016-06-10 Thread Michael Selik
On Thu, Jun 9, 2016, 9:11 PM Ho Yeung Lee wrote: > input are these six operators, output is finding full column of 27 > elements add together is 54 > > i got memory error when searching this, > > i have difficulty in understanding map reduce and transforming my program > into map reduce problem >

Re: for / while else doesn't make sense

2016-06-10 Thread Ian Kelly
On Jun 10, 2016 6:37 AM, "Marko Rauhamaa" wrote: > > alister : > > > Or more simply a hard fixed RULE (MUST be less than X lines) is Bad. > > It's not X lines, it's "you must see the whole function at once." > > If your display can show 1,500 lines at once, that's your limit. Mine > shows 70. I d

Re: UserList - which methods needs to be overriden?

2016-06-10 Thread Michael Selik
On Fri, Jun 10, 2016, 4:05 AM Nagy László Zsolt wrote: > 2016.06.10. 0:38 keltezéssel, Michael Selik írta: > > On Thu, Jun 9, 2016 at 5:07 AM Nagy László Zsolt > wrote: > >> I would like to create a collections.UserList subclass that can notify >> others when the list is mutated. >> > > Why not

Re: UserList - which methods needs to be overriden?

2016-06-10 Thread Michael Selik
On Fri, Jun 10, 2016 at 9:18 AM Michael Selik wrote: > > > On Fri, Jun 10, 2016, 4:05 AM Nagy László Zsolt > wrote: > >> 2016.06.10. 0:38 keltezéssel, Michael Selik írta: >> >> On Thu, Jun 9, 2016 at 5:07 AM Nagy László Zsolt >> wrote: >> >>> I would like to create a collections.UserList subcla

Re: for / while else doesn't make sense

2016-06-10 Thread alister
On Fri, 10 Jun 2016 15:31:11 +0300, Marko Rauhamaa wrote: > alister : > >> Or more simply a hard fixed RULE (MUST be less than X lines) is Bad. > > It's not X lines, it's "you must see the whole function at once." > > If your display can show 1,500 lines at once, that's your limit. Mine > shows

Re: for / while else doesn't make sense

2016-06-10 Thread Marko Rauhamaa
alister : > Or more simply a hard fixed RULE (MUST be less than X lines) is Bad. It's not X lines, it's "you must see the whole function at once." If your display can show 1,500 lines at once, that's your limit. Mine shows 70. > a flexible GUIDELINE on the other hand is reasonable. There are r

Re: Tie dictionary to database table?

2016-06-10 Thread Peter Otten
Peter Heitzer wrote: > Christian Gollwitzer wrote: >>Am 10.06.16 um 09:30 schrieb Peter Heitzer: >>> Michael Selik wrote: An ORM might be overkill. If you just want a persistent dictionary, just use the shelve module. https://docs.python.org/3/library/shelve.html >>> That looks li

Re: for / while else doesn't make sense

2016-06-10 Thread alister
On Thu, 09 Jun 2016 18:19:23 +1000, Steven D'Aprano wrote: > On Thursday 09 June 2016 10:34, Lawrence D’Oliveiro wrote: > >> In my undergraduate Comp Sci classes, we used to discuss arbitrary >> rules like limiting functions to n lines. With real-world experience, >> it soon became clear that suc

Re: Tie dictionary to database table?

2016-06-10 Thread Peter Heitzer
Christian Gollwitzer wrote: >Am 10.06.16 um 09:30 schrieb Peter Heitzer: >> Michael Selik wrote: >>> An ORM might be overkill. If you just want a persistent dictionary, just >>> use the shelve module. https://docs.python.org/3/library/shelve.html >> That looks like tie in Perl. Unfortunately I ha

Re: UserList - which methods needs to be overriden?

2016-06-10 Thread Maxime S
2016-06-10 10:37 GMT+02:00 Peter Otten <__pete...@web.de>: > > Nagy László Zsolt wrote: > > > I'm not sure wich one is the best. Peter wrote that UserList was left in > > collections only for backward compatiblity. This might be a point > > I'll take that back. I looked around and found no evidence

Re: UserList - which methods needs to be overriden?

2016-06-10 Thread Peter Otten
Nagy László Zsolt wrote: > I'm not sure wich one is the best. Peter wrote that UserList was left in > collections only for backward compatiblity. This might be a point I'll take that back. I looked around and found no evidence for my claim. Only MutableString was removed during the transition to

Re: Want to play with or learn a parser system including a grammar for Python? See spark_parser on pypy

2016-06-10 Thread Robin Becker
On 08/06/2016 19:32, rocky wrote: .. Sorry that should have been 1998 which would make more sense for the 7th conference if the 1st one was around 2001. I've corrected the date in [1] https://pypi.python.org/pypi/spark_parser/1.3.0 The automated tests in the package just don't catch

Re: UserList - which methods needs to be overriden?

2016-06-10 Thread Nagy László Zsolt
2016.06.10. 0:38 keltezéssel, Michael Selik írta: > On Thu, Jun 9, 2016 at 5:07 AM Nagy László Zsolt > wrote: > > I would like to create a collections.UserList subclass that can notify > others when the list is mutated. > > > Why not subclass MutableSequence

Re: Tie dictionary to database table?

2016-06-10 Thread Christian Gollwitzer
Am 10.06.16 um 09:30 schrieb Peter Heitzer: Michael Selik wrote: An ORM might be overkill. If you just want a persistent dictionary, just use the shelve module. https://docs.python.org/3/library/shelve.html That looks like tie in Perl. Unfortunately I have to use mysql as database and I need c

Re: Tie dictionary to database table?

2016-06-10 Thread Peter Heitzer
Michael Selik wrote: >On Thu, Jun 9, 2016 at 9:10 AM justin walters >wrote: >> It looks like you might be looking for an ORM. Have you checked out >> sqlalchemy? >> >An ORM might be overkill. If you just want a persistent dictionary, just >use the shelve module. https://docs.python.org/3/librar